You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Rob Bradley <ro...@ttlco.com> on 2009/08/24 18:06:56 UTC
Capturing Text in a Location
Hello all,
When I use a PDFTextStripperByArea, it appears to only capture text that starts within the bounds. Not text that flows into it.
Am I doing something wrong?
For example, if I add some text on a page that starts at 100,100 that extends well over 200 points then save and close the document. Next if I reload the document and try to capture the text at 150,100,50,10 it returns nothing. But if I capture text at 100,100,50,10 it gets the text.
PDFTextStripperByArea pdfGetText = new PDFTextStripperByArea();
pdfGetText.addRegion("Example", new java.awt.Rectangle(150, 100, 50, 10));
pdfGetText.extractRegions(pdfPage);
String sValue = pdfGetText.getTextForRegion("Example");
Thanks
Rob Bradley