xcode iPhone/iPad 上的 PDF 超链接
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2609602/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PDF hyperlinks on iPhone/iPad
提问by RoLYroLLs
I've been looking around Google and SO and haven't quite found an answer to my question, or at least a more recent answer.
我一直在环顾 Google 和 SO,但还没有完全找到我的问题的答案,或者至少是最近的答案。
I have a PDF with hyperlinks/hotspots in it and would like to display the PDF file in my own iPhone/iPad app. When the user clicks on a hyperlink/hotspot I would like the user to be taken to the appropriate location of the link (whether another page on the PDF or a webpage outside of the app).
我有一个包含超链接/热点的 PDF,并希望在我自己的 iPhone/iPad 应用程序中显示该 PDF 文件。当用户点击超链接/热点时,我希望用户被带到链接的适当位置(无论是 PDF 上的另一个页面还是应用程序之外的网页)。
I have found many questions like this on here, but most dated over 6 moths ago. While that might not be so long ago, it kind of is in-spite of newer technologies and the probability of someone comping up with new code/way to do it. I looked into the QuartzDemo sample app and edited the PDF to have a hotspot and it does not work. Maybe the ability is there, but not implemented?
我在这里发现了很多这样的问题,但大多数都是 6 个月前的。虽然这可能不是很久以前,但尽管有更新的技术和有人用新的代码/方式来做这件事的可能性。我查看了 QuartzDemo 示例应用程序并编辑了 PDF 以获得一个热点,但它不起作用。也许有能力,但没有实施?
I have found one app that DOES work great! The GoodReader app displays my PDF and allows the clicking of hotspots in my PDF. However, I'd like this implemented in my own app.
我发现了一款非常好用的应用程序!GoodReader 应用程序显示我的 PDF 并允许单击我的 PDF 中的热点。但是,我希望在我自己的应用程序中实现这一点。
So, has anyone been playing around with this? Anyone find a solution? Can anyone point others in a direction?
那么,有人玩过这个吗?有人找到解决方案吗?任何人都可以指出其他人的方向吗?
Thanks for your time.
谢谢你的时间。
采纳答案by jbm
The "hotspots" you speak of are PDF links. Look up the PDF spec, particularly section 8.4 on Link Annotations. Then look over the Quartz 2D Programming Guide including the section on Inspecting PDF Document Structure. You'll want to get familiar with the CGPDF*
API calls.
您所说的“热点”是 PDF 链接。查找PDF 规范,特别是关于链接注释的第 8.4 节。然后查看 Quartz 2D 编程指南,包括检查 PDF 文档结构部分。您需要熟悉CGPDF*
API 调用。