Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the best approach for modifying PDF interactive form fields on iOS?

I've been doing some head banging on this one and solicit your advice.

I am building an app that as part of it's features is to present PDF forms; meaning display them, allow fields to be changed and save the modified PDF file back out. UIWebViews do not support PDF interactive forms.

Using the CGPDF apis (and benefit from other questions posted here and elsewhere), I can certainly present the PDF (without the form fields/widgets), scan and find the fields in the document, figure out where on the screen to draw something and make them interactive.

What I can't seem to figure out is how to change the CGPDFDictionary objects and write them back out to a file. One could use the CGPDF Apis to create a new PDF document from whole cloth, but how do you use it to modify an existing file?

Should I be looking elsewhere such as 3rd party PDF libs like PoDoFo or libHaru?

I'd love to hear from anyone who has successfully modified a PDF and written it back out as to your approach.

like image 948
gbreen Avatar asked Jan 14 '11 21:01

gbreen


People also ask

How do I edit a fillable PDF on my iPhone?

Open the Acrobat app and press the plus sign at the bottom of the screen. Choose the edit a PDF option and then navigate to the form you want. Touch the pencil icon at the bottom of the screen, then select edit PDF. Fill in the form and touch done at the top of the screen.

How do I change the interactive fields in a PDF?

To edit a single form field, double-click it or right-click it and choose Properties. To edit multiple form fields, select the fields that you want to edit, right-click one of the selected fields, and choose Properties.

Can you fill out a fillable PDF on iPhone?

How to fill out a PDF form on your iPhone or iPad: Download PDF Expert from the App Store. Open the PDF form you want to fill out. Tap a text field or checkbox to start filling in.


1 Answers

I once did this incredibly cheaply by munging through the PDF -- I mean using regular expressions -- and just dirtily changing the actual raw text of the raw PDF data file.

It can work perfectly in simple situations where you are easily able to find the value in question.

No idea what you're trying to do here but a lateral thought! Hope it helps!

like image 169
Fattie Avatar answered Oct 21 '22 15:10

Fattie