iPhone, CGPDFDocument - PDF links

半城伤御伤魂 提交于 2019-11-29 20:42:49

This is a non-trivial question, which is why you've found no easy answer. The solution is: you have to parse the PDF document. The good news is, there are functions provided by Apple to allow you do to this. The bad news is, they're procedural, and man, is it a convoluted mess.

In very rough pseudo code:

  • use CGPDFDocumentGetCatalog to get the catalog for the PDF
  • look in the "pages" element of the catalog for the page you're looking for (yes, it's a dictionary, not an array, and a nested one, so this simple operation is not-so-simple).
  • now use CGPDFDictionaryGetArray to get the "Annots" object
  • next, you need to iterate through the annotations and look for "Link" objects.

Adobe has published a document that lays out the PDF specification. Good luck!

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