Reading PDF files as string through iPhone application

i have a library that can do this exact thing linked over here : https://bitbucket.org/zachron/pdfiphone/overview


If you want to extract some content from a pdf file, then you may want to read the following:

Parsing PDF Content

from the Quartz 2D programming guide.

Basically, you will use a CGPDFScanner object to parse the contents, which works as follows. You register a few callbacks that will be automatically invoked by Quartz 2D upon encountering some pdf operators in the pdf stream. After this initial step, you then actually start parsing the pdf stream.

Taking a brief look at your code, it appears that you are not following the steps required to parse the pdf content of the page you get through CGPDFDocumentGetPage(). You need first to setup the callbacks using CGPDFOperatorTableCreate() and CGPDFOperatorTableSetCallback(), then you get the page, you need to create a content stream using that page (using CGPDFContentStreamCreateWithPage()) and then instantiate a CGPDFScanner through CGPDFScannerCreate() and actually start scanning through CGPDFScannerScan().

The "Parsing PDF Content" section of the document pointed out by the above URL gives you all of the information required to implement pdf parsing.

Hope this helps.