views:

17

answers:

0

Hi all,

I am trying to parse a PDF and extract catalogue from it. For this purpose I am using following code: -

CGPDFPageRef page = CGPDFDocumentGetPage(document, currentPage);  //1
myContentStream = CGPDFContentStreamCreateWithPage (page);        //2
myScanner = CGPDFScannerCreate (myContentStream, table, NULL);    //3
CGPDFScannerScan (myScanner);                                     //4
CGPDFPageRelease (page);                                          //5
CGPDFScannerRelease (myScanner);                                  //6
CGPDFContentStreamRelease (myContentStream);                      //7

My problem is that the app crashes at line 2. I have debugged and checked that page is properly initialized, but even then it crashes on invoking CGPDFContentStreamCreateWithPage. Sometimes it may not crash here and myContentStream is initialized, but then it crashes at line 3.Not able to understand why it crashes. Can anyone please help me.

Thanks Amit