Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Filling Form Dropdown with PHP/PDFtk

New Here ,
Apr 26, 2018 Apr 26, 2018

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)

TOPICS
PDF forms
2.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Apr 26, 2018 Apr 26, 2018

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

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 26, 2018 Apr 26, 2018

These are not Adobe products.  Perhaps there is a forum from the makers of these products.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 26, 2018 Apr 26, 2018

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 26, 2018 Apr 26, 2018

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

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 26, 2018 Apr 26, 2018

I'll check it out, seems the most logical thing to do, then I would just parse the form with PDFtk using the FDF.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 26, 2018 Apr 26, 2018

Info: Not all browsers supports FDF.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 26, 2018 Apr 26, 2018

?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 26, 2018 Apr 26, 2018

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 26, 2018 Apr 26, 2018

It's all server-side scripting, actually and I would just make the file available once it's been treated.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 26, 2018 Apr 26, 2018

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 26, 2018 Apr 26, 2018

Yeah, I know many tools are now deprecated or not being maintained anymore, but I'll still try using some.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 26, 2018 Apr 26, 2018
LATEST

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.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines