Active1 year, 9 months ago

To create a forms data format (fdf) data file, use a pdf document with Adobe Acrobat or Adobe Reader software. How to Create an Fdf Data File; How to Create an Fdf Data File. March 31, 2015. By: Maureen Bruen. Share; Share on Facebook; To create a forms data format (fdf) data file, use a pdf document with Adobe Acrobat or Adobe Reader. Re: Using PHP to process submitted PDF Form and Upload FDF to Server (kpenner) Oct 2, 2008 7:21 PM ( in response to (badaboom55) ) This is PHP code for sending an XML file via HTTP Submit into a MySQL database. I begged people on this forum for months for a script like this. The easiest method to automatically load the fdf file is to open the 'pdf' file via php. With use of Acrobat document -> page action -> page open -> add -> javascript. Creates a new FDF document. This function is needed if one would like to populate input fields in a PDF document with data. PDF, FDF filling forms. I don't know how should I do the pdf editing in PHP because using libraries such as pdftk is not an option, the server is not local so I.

i want to extract the available fields as an array from a fillable pdf.

an array like: array('firstname','secondname','address');

i do not need the values for those fields, if they are filled.

what is easiest way to do that using PHP?

ConfidenceConfidence
1,3412 gold badges25 silver badges52 bronze badges

Php Create Pdf From Fdfd

4 Answers

under online documentation for 'fdf_next_field_name' the following example is given that you can modify to store the field names into an array

Murray McDonaldMurray McDonald

I upvoted Murray's answer because her was in ernest and I am pretty sure that he is right pre php 5.3

Sadly, pecl fdf is no more. Free program epson stylus sx100 adjustment program.

Thankfully, one 'noah' made a comment on the php documentation with a preg_match_all regex solution to the problem. Included here with slight modifications for clarity. Long live noah.

Php Create Pdf From Fdf File

I expect that someone will get fedup with the lack of true fdf support in php and fix this.

Since we are all probably after the same basic workflow if you are reading this question, then you should know that the basic workflow that I am following is:

Canon

  • download normal pdf form.
  • use libreoffice to make it a pdf form with named fields.
  • use pdftk to turn it into a fdf file
  • use this function to figure out what values the form needs.
  • populate a flat php array with the correct variables defined (from db/whatever)
  • use pdf_forge to create a new fdf with the values pre-filled
  • use pdftk again to create a new pdf from fdf+original-pdf with the variables (from db/whatever)
  • profit

HTH

-FT

Community
ftrotterftrotter
1,9782 gold badges28 silver badges45 bronze badges

If you control the pdf and just want the keys, the following will work. Uses php, no other libraries (good if you host doesn't have them).

Set the pdf submit button to html and set the page to the address where your php code will run.

Php Create Pdf From Fdf Airport

The html query string, from the pdf file, is put into the variable $q_string. It is then parsed into an array called $pdf_array. $pdf_array holds all of the keys and values. Then array_keys() is used to put all the keys into $pdfkeys as you wanted.

I had come here looking how to read pdf values to put into a db, and finally after some more poking around came up with the above. Hopefully meets some people's needs. xfdf can also work, but you will need to parse as xml then -- this was simpler for me.

Create Fdf File From Excel

SternerSterner

I get a normal post from PDFs submitting to my server, but not in the $_POST array. You just have to parse it from php://input:

BarryDevSFBarryDevSF

Fdf File Format Example

Not the answer you're looking for? Browse other questions tagged phparraysformspdffdf or ask your own question.