Get text coordinates from pdf on iphone

Is there a way to get the text coordinates from a PDF file on the iPhone?

Thanks,

Nav

More: I am trying to get words from a pdf file and select them. Although this is a fairly simple task in Mac OS X that has PDFKit, it is not so trivial on the iPhone, which has a set of Quartz functions for presenting and receiving information from a pdf file. So far, I have tried and succeeded in the following: get a list of words from a pdf file, looking at its contents and using Tj and TJ operators (see how to search for text in pdf ). While Tj gives a string, and I can get words from it, TJ is an array of glyphs, probably because most of its members come as separate characters, but joining them together gives a string, and I can get words from there.

Now my problem is to highlight the found words, which can be done by searching for the TD / Td operators and trying to calculate the character boxes myself, but for this I probably need to get the font / style and other characteristics of the glyphs so that I can correctly calculate glyph blocks. And, probably, somehow to build a transformation matrix or something like this ... Can anyone shed some light?

+4
source share
2 answers

solved with open source poppler library

+1
source

I try to do the same, but it is too technical to create a parser myself. Then I recently found open source FastPDFKit. There is a free version with a sample iOS project that includes search and selection.

http://mobfarm.eu/fastpdfkit

After reading the other answers, I will also start learning Poppler. If anyone has a sample project, please let me know :)

0
source

All Articles