【问题标题】:Simple Pdf Viewer using CGPDF使用 CGPDF 的简单 Pdf 查看器
【发布时间】:2015-01-23 09:14:14
【问题描述】:

我需要在 iOS 中创建一个 pdf 查看器应用程序。我发现使用 Quartz CGPDF 可以实现这一点,但我找不到合适的开始。我检查了苹果文档 .https://developer.apple.com/library/ios/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_pdf/dq_pdf.html 。任何人都可以建议任何有关此的示例代码或教程。我不想在网络视图中显示 pdf 或不想使用任何第三方框架。

提前致谢。

【问题讨论】:

    标签: ios objective-c cgpdf


    【解决方案1】:

    这对我来说效果很好。鉴于,它在 Apple TV 上,但它不使用 WebKit,我相信它在 iOS 上也能正常工作。它使用 CGPDF 从本地源或 URL 绘制 PDF。

    Rendering PDF in Apple TV tvOS

    还想指出,在上面写着UIGraphicsBeginImageContext(pageRect.size) 的地方,我用UIGraphicsBeginImageContextWithOptions(pageRect.size, NO, 5.0); 代替了它,因为我发现创建的CGPDF 图像非常模糊和模糊。通过使用选项开始 contxt,您可以更改比例因子 (5.0),这会增加图片数量,从而提高分辨率。

    【讨论】:

      【解决方案2】:

      查看 Apple 示例代码中的“ZoomingPDFViewer”项目。

      https://developer.apple.com/library/ios/samplecode/ZoomingPDFViewer/Introduction/Intro.html

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-10-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-06-30
        • 2015-09-27
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多