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.
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.
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.
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.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With