ZF-141: Possibility to replace placeholders in an existing PDF with form data

Issue Type: New Feature Created: 2006-06-23T09:14:22.000+0000 Last Updated: 2013-02-10T16:17:04.000+0000 Status: Open Fix version(s): - Next Minor Release ()

Reporter: Alexander Veremyev (alexander) Assignee: Alexander Veremyev (alexander) Tags: - Zend_Pdf

Related issues: Attachments: - setTextField.patch


PDF standard offers several interactive features. One of them is interactive form processing (sometimes referred to as an AcroForm).

Forms are described by 8.6 section of PDF Reference V1.6

That would be good to have possibility to create PDF form and to fill it.


Posted by Bill Karwin (bkarwin) on 2006-11-13T15:26:52.000+0000

Changing fix version to 0.6.0.

Posted by Alexander Veremyev (alexander) on 2007-05-25T05:49:51.000+0000

Postponed to post-1.0 period

Posted by Wil Sinclair (wil) on 2008-04-18T13:12:05.000+0000

This doesn't appear to have been fixed in 1.5.0. Please update if this is not correct.

Posted by Floris Bos (max) on 2010-01-06T19:33:45.000+0000

I needed this feature, and could not wait, so I added it myself to Zend_Pdf. Attached my unofficial implementation, for anyone who might find it useful.

Can be used to prepopulate Acroform form fields that already exist in a .pdf, like this:

$pdf = Zend_Pdf::load('input-file-containing-form.pdf'); $pdf->setTextField('name', 'Someone'); $pdf->setTextField('address', '1 Main Street'); $pdf->setTextField('city', 'Cyberspace'); $pdf->save('outputfile.pdf');

Posted by Xavier Lacot (xavier.lacot) on 2011-02-03T10:10:26.000+0000

I just added an improved patch based on the one of Floris, which also implements a dummy hasTextField() method

Posted by Xavier Lacot (xavier.lacot) on 2011-02-03T10:14:47.000+0000

Well, I just seem not to be allowed to post a patch on this ticket... It is available on demand.

Posted by Ryan Masten (doobywho) on 2011-06-17T19:47:59.000+0000

I believe there is something incorrect here somewhere. When trying to use PDFTK to "flatten" the PDF form after filling it in, PDFTK generates a PDF without the form data. However, when creating a FDF file with PHP and filling in the PDF with PDFTK and THEN flattening the file, it works fine.

On a separate note, it would be nice if Zend_PDF could flatten a PDF. I hate having to mess with PDFTK.

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.