2

I am developing iPad PDF viewer application for iPad. I am stuck with 2 feature to implement.

  • Search and highlight the text in the searched page
  • Extract the TOC (outline) from PDF.

Please help me with any pointers will be more than appreciable. Looking forward to hear back on this.

UPT
  • 1,490
  • 9
  • 25

2 Answers2

1

I have not seen an open source solution that has TOC extraction in it. There are a variety of posts on the subject of PDF parsing in iOS on SO. This is one of the top ones with a plethora of information within it, including links to some pointers regarding TOC extraction:

Fast and Lean PDF Viewer for iPhone / iPad / iOs - tips and hints?

In regards to specifically TOC extraction, it will be very beneficial to read some portions of the immense PDF specification, and also to download Voyeur for os x to look at the actual structure of your PDF's.

Community
  • 1
  • 1
shawnwall
  • 4,549
  • 1
  • 27
  • 38
0

Here is the same question being answered:

CGPDFDocumentRef doc = ...; 
CGPDFDictionaryRef outlinePageRef = ...; 
for (int p=1; p<=CGPDFDocumentGetNumberOfPages(doc); p++) 
{ 
CGPDFPageRef page = CGPDFDocumentGetPage(doc, p); 
if (page == outlinePageRef) { 
printf("found the page number: %i", p); 
break;
}
}
UPT
  • 1,490
  • 9
  • 25