Is there any way to extract the text of a specific region using ICEpdf? I was able to extract whole pages, but that's not what I want to do.
(I know PDFBox nicely extracts the text in a specific rectangular area of a page. However, since the image rendering works a lot better in ICEpdf, I'd like to use that library.)
ON the Page object that represents a page you can call the method:
Similar to the bundle example ./examples/extraction/PageTextExtraction.java
The PageText object contains all the LineText->WordText->GlyphText objects for the page. LineText, WordText and GlyphText all extend AbstractText which has a getBounds() method. The bounds of these objects are in PDF user space, the 1st geometric quadrant. Java2D is in the 4th geometric quadrant. Assuming you already have the selectionRectangle the code would be as follows: