I am trying to extract text from a pdf from a specific region of the page,
using these objects:
Dim ScanArea As System.util.RectangleJ
Dim TextScanFilter As iTextSharp.text.pdf.parser.RegionTextRenderFilter
Dim TextScanListener As iTextSharp.text.pdf.parser.FilteredTextRenderListener
Dim iTextPageSize = Extractor.GetPageSize(CurrentPageIndex)
Dim CurrentTemplate As ExtractionTemplate = PageTemplates(TemplatePageNumber)
ScanArea = New
System.util.RectangleJ(selectedarea.ScaledLowerLeftX,Extractor.GetPageSize(CurrentPageIndex).Height
- selectedarea.ScaledLowerLeftY, selectedarea.ScaledWidth,
selectedarea.ScaledHeight)
TextScanFilter = New iTextSharp.text.pdf.parser.RegionTextRenderFilter(ScanArea)
TextScanListener = New
iTextSharp.text.pdf.parser.FilteredTextRenderListener(New
iTextSharp.text.pdf.parser.LocationTextExtractionStrategy(), {TextScanFilter})
Dim s = TextScanListener.GetResultantText()
Dim ExtractedText =
iTextSharp.text.pdf.parser.PdfTextExtractor.GetTextFromPage(Extractor,
CurrentPageIndex, TextScanListener)
At this point, the ExtractedText variable contains the text in the area, as
well as the text to the right and left of the area. The height appears to be
correct, but extraction width seems to be ignored completely. Is there
something I'm doing wrong here? Is this a feature that is not fully functional
in the non-commercial version of the assembly?
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php