0

I want to read a value from a specific area of a PDF file.

text to be read, reading area marked in red

For this, I have defined an area in the PDF that should be read.

MyCode:

Dim pageNumber As Integer = 1
Dim rect = New iTextSharp.text.Rectangle(408, 648, 570, 665)
Dim filters As RenderFilter() = {New RegionTextRenderFilter(rect)}
Dim strategy As ITextExtractionStrategy = New FilteredTextRenderListener(
    New LocationTextExtractionStrategy(), filters)
extractedText = PdfTextExtractor.GetTextFromPage(reader, pageNumber, strategy)

However, when I read the area with my code, I receive the following result: extractedText = ". : r N g - a r t u f A 0 3 7 4 0 2 3 2"

What am I doing wrong?

Thank you for your suggestions!

Sven

Dim pageNumber As Integer = 1
Dim rect = New iTextSharp.text.Rectangle(408, 648, 570, 665)
Dim filters As RenderFilter() = {New RegionTextRenderFilter(rect)}
Dim strategy As ITextExtractionStrategy = New FilteredTextRenderListener(
    New LocationTextExtractionStrategy(), filters)
extractedText = PdfTextExtractor.GetTextFromPage(reader, pageNumber, strategy)
2
  • Same problem here: itextsharp - extracts text backwards. There seems to be no solution to this problem. Commented Jul 3 at 11:21
  • This is uncommon. In particular the LocationTextExtractionStrategy does sort by position. Thus, I assume there is something special about your document. Can you share it? Commented Jul 3 at 12:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.