OCR SCAN PART PDF DOCUMENT AND WRITE VALUE IN TEXTBOX C#

  • 37 Views
  • Last Post 2 weeks ago
Stylus STYLUS posted this 3 weeks ago

Some help?   Some recommendation?   I try this but this is for all page  

private void Button1_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog ofd = new OpenFileDialog() { Filter = "PDF Files|*.pdf", ValidateNames = true })

            {
                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        iTextSharp.text.pdf.PdfReader reader = new iTextSharp.text.pdf.PdfReader(ofd.FileName);
                        StringBuilder sb = new StringBuilder();
                       // for (int i =1; i <= reader.NumberOfPages; i++)
                        for (int i = 1; i <= reader.NumberOfPages; i++)

                        {

                                sb.Append(PdfTextExtractor.GetTextFromPage(reader,i));

                        }
                        textBox1.Text = sb.ToString();
                        reader.Close();

                    }

                    catch (Exception ex)

                    {
                        MessageBox.Show(ex.Message,"Message",MessageBoxButtons.OK,MessageBoxIcon.Error);
                    }
                }
            }
        }
Stylus STYLUS posted this 2 weeks ago

 

... need same this BUT for pdf

 

 

Close