开发者

How can I edit PDF files in an iOS application?

开发者 https://www.devze.com 2023-03-23 12:58 出处:网络
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.

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.

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.

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


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.

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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号