UPT
UPT

Reputation: 1480

Extract TOC from PDF in iPad

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

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

Upvotes: 2

Views: 855

Answers (2)

UPT
UPT

Reputation: 1480

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;
}
}

Upvotes: 0

shawnwall
shawnwall

Reputation: 4607

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.

Upvotes: 1

Related Questions