简体   繁体   English

在iOS中渲染PDF

[英]Rendering PDF in iOS

Need help on rendering PDF using CGPDFContext . 需要有关使用CGPDFContext渲染PDF的帮助。 I am currently using UIWebView to display PDF but would like to perform much more operation rather than just reading like Highlight Text, Search PDF, Annotate PDF. 我目前正在使用UIWebView来显示PDF,但是想要执行更多操作,而不仅仅是阅读高亮文本,搜索PDF,注释PDF。 Not looking for using any Framework or library. 不寻找使用任何框架或库。 Any help will be beneficial. 任何帮助都是有益的。 For a start, code on how to render PDF using CGPDF and displaying it instead of using UIWebView . 首先,介绍如何使用CGPDF呈现PDF并显示它而不是使用UIWebView

PDF annotations are a rabbit hole. PDF注释是一个兔子洞。 I've been working on them since 2010. The spec is thousands of pages. 自2010年以来,我一直在研究它们。规格是数千页。 It's easy to get started but it takes forever to get right with all the PDFs and variations out there. 它很容易上手,但是要花所有的时间来正确处理所有PDF和版本。 Even a simple feature like bookmarks are harder than you would think. 即使像书签这样的简单功能也比你想象的要难。

To date there's no open source framework that implements PDF annotations. 到目前为止,还没有实现PDF注释的开源框架。 The above linked one can be a good starting point. 以上链接可以是一个很好的起点。 If you don't have months/years to build something on your own, there are a few commercial options available - like PSPDFKit , available for iOS, Android and Web, which I am building. 如果你没有几个月/几年自己构建一些东西,那么有一些商业选择 - 比如PSPDFKit ,可用于iOS,Android和Web,我正在构建。

We have a guide article listing the most important PDF spec documents . 我们有一份指南文章,列出了最重要的PDF规范文档 Searching is another tricky topic. 搜索是另一个棘手的话题。 It's quite hard to convert the PDF text data to unicode. 将PDF文本数据转换为unicode非常困难。 The Adobe CIDFont spec is a good starting point. Adobe CIDFont规范是一个很好的起点。

You shoud try VFReader , it is an open source project for rendering PDF files on iOS. 您应该尝试使用VFReader ,这是一个用于在iOS上呈现PDF文件的开源项目。 It can be a good starting point. 这可能是一个很好的起点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM