使用 CGPDF API 在 iPad 中显示 PDF

发布于 2024-09-06 07:50:08 字数 1435 浏览 8 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

浮生面具三千个 2024-09-13 07:50:08

在 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!

酒儿 2024-09-13 07:50:08

使用 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文