4
votes

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

Thanks,

Nava.

More details: I'm trying to get words from pdf file and highlight them. While it's a pretty simple task in Mac OS X, which has a PDFKit, it's not that trivial on iPhone, which has Quartz set of functions to present and get information from pdf file. So far I tried and succeed in following - get words list from pdf file scanning its content and using Tj and TJ operators (see how to search text in pdf). While Tj gives a string and I can get words from it, TJ is an array of glyphs probably, since most of its members come as a single characters, but connecting them together still gives a string and I can get words from there.

My problem now is to highlight found words, which may be can be done by finding a TD/Td operators and trying to calculate character boxes by myself, but for this I need probably to get a font/style and other characteristics of glyphs to be able to calculate glyph boxes properly. And probably somehow to build a transformation matrix or something like this... Anybody can shed some light?

2
Please describe in more detail and with examples what you are trying to do and what your problem is.DarkDust
can you please give me some suggestion regarding the pdf search and highlight word stackoverflow.com/questions/5354457/…ajay

2 Answers

1
votes

solved with open source poppler library

0
votes

I have been trying to do the same but it's too technical to build a parser myself. Then I found FastPDFKit open source sdk recently. There is a free version with sample iOS project that includes search and highlight.

http://mobfarm.eu/fastpdfkit

After reading the other answers I will start exploring Poppler too. If someone has a sample project please let me know :)