QUESTION: What is XFDF?
ANSWER: XFDF stands for "XML Forms Data Format." XFDF is an XML-based file format for representing form data and annotations that are contained in a PDF form.
The XFDF format can be used in a variety of workflows. Here are a just couple of examples:
Sending form data to a server and receiving modified form data back from the server.
This workflow would look something like this:
- Form data in XFDF format is submitted to the server. (Typically, this would happen when a human user at a client machine clicks a "Submit" button on the form.)
- On the server, the XFDF data is modified.
- The server sends the modified XFDF data back to the client.
- At the client machine, the fields in the form are populated with the modified data.
Archiving form data. This workflow would look something like this:
- A human user uses Adobe Acrobat or some other PDF-viewing/editing application* to export the form data in XFDF format.
- The XFDF file is saved in the company's archives.
- To look at the form data, a human user would use Adobe Acrobat or some other PDF-viewing/editing application* to open the XFDF file; this would cause the PDF-viewing/editing application to 1) find the PDF form from which the form data was exported, 2) load the form data into the form, 3) display the form with the loaded data on the screen.
You might be wondering why you'd want to archive an XFDF file containing the data for a PDF form instead of simply archiving a uniquely named version of the entire PDF form with the data included in it. There are two reasons:
- An XFDF file containing form data for a PDF form is much smaller than the file containing the PDF form itself, so archiving XFDF files requires less storage space than archiving PDF forms.
- Some software that people use to view and interact with PDF forms does not allow the user to save a filled-in PDF form.
IMPORTANT NOTE TO DEVELOPERS: An XFDF file contains the filename and location of the PDF form from which the form data in that particular XFDF file was exported. Adobe Acrobat (and any PDF-viewing/editing application that supports PDF forms) relies on that filename and location in order to retrieve and open the appropriate PDF form when opening an XFDF file. In other words: when opening an XFDF file, a PDF viewing/editing application assumes that the PDF form from which the form data was exported is available at the specified location.
Therefore, if you are a developer considering implementation of a system that archives XFDF data, you'll want to make sure your system has a reliable method of storing the required PDF forms in known locations. Otherwise, it will not always be possible for PDF-viewing/editing applications to retrieve and open the PDF Forms when they are needed.
*Some PDF-viewing/editing applications do not support all features and functionality related to PDF forms.
Creating your own XFDF files
As mentioned, the two workflows described above are just examples of how you can utilize XFDF data. Both of those workflows rely on a PDF-viewing/editing application such as Adobe Acrobat for creation of the XFDF data.
However, you don't have to rely on a PDF-viewing/editing application to generate XFDF data — it is possible to generate XFDF data yourself, and depending upon what you need to accomplish, it might make sense to do just that. For example, if you have data stored in a database, it would be possible (if you are a programmer or if you have access to someone with programming skills) to extract data from your database and put it in XFDF format. Or, if you have a Web site where site visitors enter data into an HTML form, you or your programmer could write a script to convert the data entered by users to XFDF format. As stated below, the XFDF format is described in detail in Adobe's XML Forms Data Format Specification. You'd need to read that document to gain an understanding of the XFDF format before you'd be able to generate your own XFDF data.
Populating PDF forms with XFDF data dynamically
A programmer can use a programmer's library or toolkit to put XFDF data into PDF forms automatically. An Internet search will lead you to companies that offer such libraries/toolkits.
How to get more information about the XFDF format
The XFDF format is described in Adobe's XML Forms Data Format Specification.
See also What is XML?
See also What is PDF?
See also What is a PDF Form?
See also What is FDF?