4 Replies Latest reply on May 15, 2015 10:20 AM by jmbrox67

    Linking a FDF file to a PDF

    Rob Hecker2-uhQIgt Level 2

      I have a MySQL database that contains records which I been able to export into a proper FDF file using PHP code examples I have found on the web. The example I have used relies on the PDFTK program to make the bridge between the created FDF and the PDF template, however, I cannot run PDFTK on my shared UNIX webserver, so I am looking for a different way to (preferably using PHP) open the PDF with the FDF data.


      I can do this manually. I can open the PDF in Acrobat, then go to FORMS > MANAGE FORM DATA > IMPORT to populate the PDF with the FDF data, but I need a solution for staff to use that happenings seemlessly. It seems like such a little thing--just getting the PDF to open with the FDF. But I have not found code that does this.


      Thanks for any suggestions. R

        • 1. Re: Linking a FDF file to a PDF
          Patrick Leckey Level 3

          What you need to do is take advantage of the /F key in the FDF Syntax - it is a link to a specific PDF document, so then all you need to do is stream the FDF to the browser.  It will open the FDF in Acrobat/Reader (assuming the user hasn't played with their application/vnd.fdf MIME type) which will then see the /F key with the PDF URL, open that PDF and merge the FDF data automatically.


          Check out the FDF Toolkit, available here:


          • 2. Re: Linking a FDF file to a PDF

            Hi Patrick,


            I know this post of yours isn't recent. I'm wondering if you could guide me on your comment above regarding "stream the FDF to the browser". What does that entail? Also, can a FDF be created from a JSON or XML object and can it be done with JavaScript? Thanks for any info.



            • 3. Re: Linking a FDF file to a PDF
              JoelGeraci_Datalogics Level 3



              FDF is somewhat cumbersome to use as it doesn't look like anything that most people are familiar with unless you've spent time working at Adobe. However, XFDF (the XML expression of FDF) works equally well for form data and is fairly straightforward to use. Rather than send the PDF to the browser, you send the XFDF with a mimetype of application/vnd.xfdf and Reader (or Acrobat) will open the file and then fetch the PDF that's referred to in the "f" element. Essentially, you don't add the data to the PDF, you add the PDF to the data. Below is an example of a simple XFDF file.


              <?xml version="1.0" encoding="UTF-8"?>

              <xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve">

              <f href="DemoForm.pdf" />


                   <field name="Name_First"><value>Joel</value></field>

                   <field name="Name_Last"><value>Geraci</value></field>

                   <field name="Name_Middle"><value>F</value></field>



              • 4. Re: Linking a FDF file to a PDF
                jmbrox67 Level 1

                This really helped. I was able to figure it out. Thanks Joel!