In API documentation there is a way to load a PDF (with Quartz): CGPDFDocument is the object you need and CGPDFDocumentCreateWithURL is probably the constructor you are looking for.
使用 Quartz API 显示 PDF 非常简单。但没有对链接注释的本机支持。基本上,您需要解析 pdf 中的“Annots”字典,然后找到正确的页面(可以是 GoTo 引用、命名引用或 ~10 个其他类型;请参阅 Adobe PDF Reference 1.7 文档,有关操作的部分),并计算显示页面的坐标。
Displaying the PDF with the Quartz APIs is pretty easy. But there's no native support for link annotations. Basically, you need to parse the "Annots" dictionary inside the pdf, and then find the correct page (which can be GoTo references, or named references, or ~10 other types; see the Adobe PDF Reference 1.7 document, the section about Actions), and the calculate the coordinates to the displayed page.
I've written a [commercial] library that includes parsing link annotations, and many more features. You may wanna check out http://pspdfkit.com
发布评论
评论(2)
在 API 文档中有一种加载 PDF 的方法(使用 Quartz):
CGPDFDocument 是您需要的对象
并且 CGPDFDocumentCreateWithURL 可能是您正在寻找的构造函数。
以下是有关如何执行此操作的一些示例:
http://developer.apple.com/mac/library/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_pdf/dq_pdf.html#//apple_ref/doc/uid/TP30001066-CH214-TPXREF109
我有在这方面花了很多时间 - 看来您需要使用 CATiledLayers 来正确缩放这些 PDF!
网上有一些关于如何做到这一点的很好的例子...
一旦我准备好了一些东西,我就会在这里放一个链接/解决方案!
In API documentation there is a way to load a PDF (with Quartz):
CGPDFDocument is the object you need
and CGPDFDocumentCreateWithURL is probably the constructor you are looking for.
Here are some examples on how to do it:
http://developer.apple.com/mac/library/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_pdf/dq_pdf.html#//apple_ref/doc/uid/TP30001066-CH214-TPXREF109
I have spent a lot of time on this - and it seems you need to use CATiledLayers to zoom those PDFs properly!
There are some good examples on the net on how to do that...
I will put a link/solution here as soon as I have something ready!
使用 Quartz API 显示 PDF 非常简单。但没有对链接注释的本机支持。基本上,您需要解析 pdf 中的“Annots”字典,然后找到正确的页面(可以是 GoTo 引用、命名引用或 ~10 个其他类型;请参阅 Adobe PDF Reference 1.7 文档,有关操作的部分),并计算显示页面的坐标。
我编写了一个[商业]库,其中包括解析链接注释以及更多功能。您可能想查看 http://pspdfkit.com
Displaying the PDF with the Quartz APIs is pretty easy. But there's no native support for link annotations. Basically, you need to parse the "Annots" dictionary inside the pdf, and then find the correct page (which can be GoTo references, or named references, or ~10 other types; see the Adobe PDF Reference 1.7 document, the section about Actions), and the calculate the coordinates to the displayed page.
I've written a [commercial] library that includes parsing link annotations, and many more features. You may wanna check out http://pspdfkit.com