Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I edit PDF files in an iOS application?

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?

like image 390
cancerian Avatar asked Jul 27 '11 15:07

cancerian


1 Answers

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.

like image 126
Yuji Avatar answered Sep 18 '22 14:09

Yuji