How can I find out the name of the fields in a PDF file using PHP?
The only thing I can think of is converting the PDF file to HTML, but that really sounds like overkill.
My end goal is to generate an FDF file (this bit I'm happy with) to populate the fields of a PDF file which I don't have control over, so I don't know what field names I need to use.
If you are willing to use a command line tool, see
https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/
The pdftk command can generate an FDF file from a PDF form file.
pdftk formfile.pdf generate_fdf
The form fields are the portion of the output that looks like
...
<< /T(f1-1) /V(text of field) >>
<< /T(f1-2) /V(text of another field) >>
...
this might be what you are after http://www.setasign.de/products/pdf-php-solutions/fpdi/