views:

2149

answers:

8

Is it possible to get access to "internal" links in PDF documents using CGPDFDocument, or other means? I'm building a simple reader app and would like to deliver my content in PDF form, but if I can't support links between pages in the doc this probably isn't going to work.

This question is similar, but does not address the issue of how to support hyperlinks.

A: 

If you're using Quartz to open and view a PDF, then yes, it looks like you will have access to internal links. Quartz will also let you add new links to PDFs. I don't have any first hand experience with iPhone/Mac development, but it would be quite strange for them to let you add hyperlinks, but not use them.

Rowan
These links both point to the Mac OS X reference library, not iPhone OS. PDFKit doesn't exist on the phone.
Ben Gottlieb
Yes above both link are just opening list of osx reference libraries. It doesn't give any proper info. How it is accepted ? -1
sugar
Sorry folks, I'm not doing iPhone dev anymore, so this is effectively an abandoned question. I'm unable to verify whether this is an acceptable answer or not, so I've just "unaccepted" it.
Caffeine Coma
A: 

bump

This is the only thing holding me back at the moment. Did you figure it out Kaffeine Coma?

brody
A: 

how it is acceptable...how is it working to a hyperlinked document from PDF in iphone? Please give details with sample code......other wise dont show this blog

+2  A: 

See my answer here. Basically, you'll need to get familiar with PDF link annotations.

jbm
A: 

You need to do in two steps.

First: Parse your pdf to locate marked content operators

That's an exemple of a parsing code :

-(void)parseContent() {
    CGPDFOperatorTableRef myTable;
    myTable = CGPDFOperatorTableCreate();
    CGPDFOperatorTableSetCallback(myTable, "BMC", &myOperator_BMC);
    CGPDFContentStreamRef myContentStream = CGPDFContentStreamCreateWithPage(page);
    CGPDFScannerRef myScanner = CGPDFScannerCreate(myContentStream, myTable, autoZoomAreas);
    CGPDFScannerScan(myScanner);
    CGPDFScannerRelease(myScanner);
    CGPDFContentStreamRelease(myContentStream); 
}

void myOperator_BMC(CGPDFScannerRef s, void *info)
{
    const char *name;
    CGPDFScannerPopName(s, &name);
}

(You need to complete and adjust this code to match your requirement)

Second: respond to the toucheEnded message to handle tap on those zones and make the UI respond accordingly.

VdesmedT
A: 

Hi YdesmedT Will u please elaborate how touchEnded can be implemented? And about zone what you are talking about?

Madhu
A: 

Ya , i got some ideas about zooming , but after tapping how to get the link address to load request,

CGPDFScannerPopName(s, &name); after this instruction , what exactly i mean , how to handle?

Parsing function enters this loop and displays WebCapture if i print that name. void myOperator_BMC(CGPDFScannerRef s, void *info) { const char *name; CGPDFScannerPopName(s, &name); }

How to get the exact link? Can u give me touchEnded code? if u can write code snippet. Thanq :)

Madhu
A: 

May i know , what is autoZoomAreas in above code?

Madhu