如何在iOS应用程序中编辑PDF文件? [英] How can I edit PDF files in an iOS application?

查看:1155
本文介绍了如何在iOS应用程序中编辑PDF文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的iPhone / iPad应用程序中,我以PDF的形式显示一个人的医疗报告。我已将报告保存在文档目录中,并从那里读取它们。

In my iPhone / iPad application, I show a person's medical reports in the form of a PDF. I have saved the reports in the documents directory and am reading them from there.

我希望用户能够在这些PDF上添加或编辑注释,以及能够突出显示PDF中的某些部分。编辑后,应用程序应该能够将PDF保存回文档目录。

I want the user to be able to add or edit comments on these PDFs, as well as be able to highlight certain sections in the PDF. After editing, the application should be able to save the PDF back into the documents directory.

这是否可以在iOS应用程序中使用?如果是这样,怎么样?这是Core Graphics的任务吗?

Is this possible within an iOS application? If so, how? Is this a task for Core Graphics?

推荐答案

直接在iPad / iPhone上编辑PDF是一项相当大的工作,因为仅限标准API支持显示它(并且只是更多。)如果你想做更多的事情,你需要花费大量的时间来实现通用的pdf处理代码。

Editing PDF directly on iPad/iPhone is a rather big job because the standard API only supports showing it (and only a bit more.) If you want to do anything more, you need to invest a huge amount of time to implement generic pdf handling code.

有一个开源库处理这些,例如这一个。不过,我不知道它是否符合您的需求。

There is an open-source library handling these, e.g. this one. I don't know if it fits your needs, though.

在我看来,更好的想法是创建一个原生用户界面,使用标准的Cocoa-Touch UIKit显示PDF文件中包含的数据,并在创建PDF后创建PDF用户完成它,以便用户可以将其导出。这样,您就不必编写复杂的PDF处理代码。

A better idea, in my opinion, is to create a native UI showing the data contained in the PDF file using the standard Cocoa-Touch UIKit and create the PDF once the user is done with it so that the user can export it back. That way, you don't have to write a complicated PDF handling code.

在任何情况下,在iPhone上显示通用PDF并不是一个好主意,因为屏幕尺寸太小(iPad是一个不同的问题,特别是如果你期望的话用户要熟悉pdf的特定格式。)专用UI会更好。

In any case, it's not a good idea to show generic PDF on iPhone, because the screen size is so small (iPad is a different question, especially if you expect the user to be familiar with the particular format of your pdf.). A dedicated UI would be much better.

这篇关于如何在iOS应用程序中编辑PDF文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆