On Sun, 2009-08-23 at 17:18 -0700, Jeff Dunlap wrote:

> I have a blank Adobe Acrobat user filled form with text fields and some 
> checkboxes.  I would like to programatically set field contents with database 
> values.
> 
> I thought that I'd simply read the form into memory and insert the required 
> text (i.e. firstname, lastname, etc) but it wasn't that easy.
> 
> For example, if a field value contains the string "John", you can replace 
> that string with "Pete" but not with "Peter" since it is one char larger.
> 
> 1) I am guessing that there must be something else in the PDF that stores the 
> field data size and that has to be updated too.  Is it something that can be 
> relatively easily done without having to install PoDoFo?


Read the PDF reference before trying to modify PDF; it'll make your life
easier.

PDF documents are structured as a set of objects accessed by a
cross-reference table that points to the byte offset of the start of the
object. Thus, if you make a change to the document that changes the byte
offset of an object you must update the xref table.

> 2) If PoDoFo is required for me to update my form fields, what specific 
> classes should I focus on?

No idea, I haven't read much about PDF forms. It also depends on the
form, as there are several different ways to build PDF forms. Start by
reading the PDF reference. Then you'll probably want to use PoDoFo's low
level PDF structure inspection code to locate and update what you're
interested in. If the form data in your case is in a content stream,
that'll include parsing and re-writing the content stream too.

There are dedicated form-filling tools that are probably more suitable
for your needs than PoDoFo.

--
Craig Ringer
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to