How to extract text from a pdf doc within a specific rectangular region in objective C?

545 Views Asked by At

I want to extract the text inside a bounding box specified inside highlight annotation using the PSPDFKit. Can anybody say how to do this?

1

There are 1 best solutions below

0
On

To get the text that's beneath a PDF highlight annotation, you need to iterate over all rects and contact the affected glyphs. (You can ignore the boundingBox for that) The highlight annotation just has rect data, not text, so it's a bit tricky to get right.

There's also a convenience method on PSPDFHighlightAnnotation called highlightedString, which will do all this work for you.