How to access hyperlinks in PDF documents (iPhone)?

放肆的年华 提交于 2019-11-30 13:24:07
jbm

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

see this sample code...pdf hyperlinks works in this

https://github.com/vfr/Reader

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!