To export data we can for example use the “submit a form” action on a button – or the Doc.submitForm() JavaScript method. What we’ve done so far by manually importing and exporting can be automated. When I now use the import function in Acrobat, I can fill my form with this updated data. I can for example change the value node to now contain the string “new data”. Pretty simple.Īs mentioned before, this file was exported from a form, so we can see what data was actually entered in the form, but the same approach can also be used to import data into the form. In the example above, we can see that there is one field in the document named “Field 1”, which contains the string “test data”. Each field node has a “name” attribute, and contains a value node with the actual data. The interesting “stuff” is happening in “fields”: It contains a list of field nodes – each one describing the data stored in a specific field. Let’s take a look at what the XFDF document above contains: There is one top level XML node (as required by the XML standard) called “xfdf”, which contains three nodes: f, fields and ids – for now we can ignore the f node (which is just a reference to the PDF file this XFDF data came from – should be imported into), and the ids node (that’s the document ID). The FDF format is described here:, and the XFDF format is described in this document: (I don’t have a link to the original Adobe hosted document, I also don’t know how reliable or trustworthy this service is). ![]() Here is a sample FDF file (slightly reformatted to make it easier to read):įor anybody with at least some XML background, it’s obvious that the XFDF file is much easier to understand and to parse. You can then select the output format on the “Save” dialog (use either FDF or XFDF). To take a look at what FDF and XFDF files look like, it’s easy to create them by exporting data from a PDF form using Adobe Acrobat: In Acrobat DC, load a form and then search for “export” in the tools search bar and select “Export data from a form file” in the “Prepare Form” cateogry. The XFDF format can do almost anything that can be done with FDF, but in a much easier to parse and to write format. Reading and writing FDF is a complex task, and Adobe used to have the FDF Toolkit, which helped with these tasks, but this toolkit has not been updated since Acrobat 7 and is not supported by Adobe anymore. The FDF format can be used to submit form data from a PDF form to a web server, and to receive information back from the server. XFDF is the XML version of FDF, the “Form Data Format”, which is based on the PDF format (it’s a stripped down version of PDF). The solution is to “talk” back and forth between the PDF form and the web server using XFDF. I assume you know how to install PHP scripts on your web server, and also how to create PDF forms that submit data to a server. You will need a web server that supports PHP if you want to follow along. So what can be done to connect a PDF form to a database in a way that also works with the free Reader? Be prepared for a long post that is of the most part about PHP running on a web server. ![]() In the past, Adobe had an ODBC interface built into the Windows version of Acrobat/Reader (named the ADBC interface), but that had the same problem as far as Reader goes, and was removed back in the days of Acrobat 9. Using SOAP poses a problem when you want to make such a solution work with the free Adobe Reader. I wrote about how to get data from (or to) a database from a PDF form using SOAP a while ago.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |