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

查看:68
本文介绍了如何在 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 文件中包含的数据的原生 UI,并在用户完成后创建 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 的特定格式.).专用的用户界面会更好.

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天全站免登陆