Copy link to clipboard
Copied
Hello, I would like to know if it is possible to dynamically fill a dropdown/list of a PDF Form using PHP or PDFtk.
I've used PHP in order to fill in some fields, I've been able to fill in text fields, select a radio button and even check boxes. (Using
mikehaertl/php-pdftk)
The only thing I can't fill is the list with a lot of values, I've just been able to "write" somehow into the field but it is not an item of the list.
I've also tried using PDFtk to export data from a FDF and a XML, it doesn't work at all.
Is it possible to fill a list using PHP or PDFtk? even a FDF or XML file would be also nice (since I can use these to use the PDFtk commands)
Copy link to clipboard
Copied
You can certainly fill lists with FDF. To do this you need to read the FDF specification. You could also use the FDF toolkit, but this is not absolutely necessary. An FDF file can be pure text, so it can be built using PHP string operations.
Google "FDF specification" and you'll get links to both the FDF spec and toolkit
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
These are not Adobe products. Perhaps there is a forum from the makers of these products.
Copy link to clipboard
Copied
In that case what would be the FDF file to populate a dropdown list?
I've tried to export data from Adobe Acrobat Pro DC with forms containing lists but the FDF files do not contain the list items. It only exports the selected item from the list but not all.
Copy link to clipboard
Copied
You can certainly fill lists with FDF. To do this you need to read the FDF specification. You could also use the FDF toolkit, but this is not absolutely necessary. An FDF file can be pure text, so it can be built using PHP string operations.
Google "FDF specification" and you'll get links to both the FDF spec and toolkit
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
I'll check it out, seems the most logical thing to do, then I would just parse the form with PDFtk using the FDF.
Copy link to clipboard
Copied
Info: Not all browsers supports FDF.
Copy link to clipboard
Copied
?
Copy link to clipboard
Copied
You'll need to test every popular browser on each platform to see if your solution works. Client side processing is pretty much dead, to be honest, because of this.
Copy link to clipboard
Copied
It's all server-side scripting, actually and I would just make the file available once it's been treated.
Copy link to clipboard
Copied
We make the point because FDF is most often used client side, by direct delivery of the FDF. With the right software an FDF can be merged server side, but I don't think Adobe have a product for that any more. If you have other APIs, they are likely to be simpler than working with FDF.
Copy link to clipboard
Copied
Yeah, I know many tools are now deprecated or not being maintained anymore, but I'll still try using some.
Copy link to clipboard
Copied
If the PDF is open in Acrobat/Reader and the FDF data is returned to Acrobat/Reader in an HTTP response, then the browser is irrelevant. All the action is contained within Acrobat. The only time you run into trouble is if the FDF is linked directly on a webpage. This is particularly problematic for mobile devices. To make this work you need a methodology where the request for the FDF happens from inside Acrobat, so that no external tools ever have to deal with the FDF.
Use the Acrobat JavaScript Reference early and often

