Alex Rivera | Logout

Extract PDF form field names from a PDF form

Asked 2010-01-24T16:54:31.593
37

I'm using pdftk to fill in a PDF form with an XFDF file. However, for this project I do not know in advance what fields will be present, so I need to analyse the PDF itself to see what fields need to be filled in, present an interface to the user accordingly, and then generate an XFDF file from that to fill in the PDF form.

How do I get the field names? Preferably command-line, .NET or PHP solutions.

Edit
Report

2 Answers

66

Easy! You are using pdftk already

# pdftk input.pdf dump_data_fields

It will output Field name, field type, some of it's properties (like what are the options for dropdown list or text alignment) and even a Tooltip text (which I found to be extremely useful)

The only thing I'm missing is field coordinates...

answered 2010-09-16T19:19:15.870
-5

I can get my client to export the XFDF file (which contains field names) using Acrobat along with the PDF, which avoids this problem completely.

answered 2010-01-24T17:41:18.893

Your Answer