Forms Data Format

by Mark Gavin

A Forms Data Format ( FDF ) file is a text file that contains a list of form field names and their values. Acrobat Forms, or AcroForms, were introduced in PDF Version 1.2.  To allow for the import and export of data from AcroForms; Adobe developed the Forms Data Format.  The documentation for the Forms Data Format is located in the PDF Reference in the chapter on “Interactive Features” under the section “Interactive Forms”.

There are two kinds of FDF files:

• Classic – supplies data to fill out an existing static form.

• Template – directs the construction of a new PDF document based on the templates found inside specified PDF files, and supplies the data to fill out the form(s) in the new document. This construction or assembly process is sometimes referred to as “spawning” new PDF pages.

Important features of an FDF file:

• An FDF file must begin with %FDF and end with %%EOF.

• The data is given as name-value pairs, also called key-value pairs :

Title – ( /T ) indicates form field name (i.e., Address 2, Name, Date)

Value – ( /V ) indicates form field value (i.e., 29 Communications Road, Suzie Smith, 24 January 2000)

• The pair is enclosed in double angle brackets: << >>

A basic FDF data file is shown below. Within it are nine name-value pairs. The lines before and after these pairs are identification and formatting information.
1 0 obj
<< /FDF
<< /Fields
<< /V (Communications Co.)/T (Address1)>>
<< /V (29 Communications Road)/T (Address2)>>
<< /V (Busyville)/T (City)>>
<< /V (USA)/T (Country)>>
<< /V (24 January 2000)/T (Date)>>
<< /V (Suzie Smith)/T (Name)>>
<< /V (\(807\) 221-9999)/T (PhoneNumber)>>
<< /V (777-11-8888)/T (SSN)>>
<< /V (NJ)/T (State)>>
/F (TestForm.pdf)>>
/Root 1 0 R

The FDF file specification structures FDF files in terms of objects. Objects are enclosed in double angle brackets: << >>. The objects of particular importance are as follows:

• Dictionary objects—collections of key/value pairs. Values can be any kind of object, including an array or another dictionary. The dictionary contents are enclosed in double angle brackets: <</dictionary << /key /value >> >>

• Array objects—collections of other objects, including dictionaries and other arrays. The content of the array object is enclosed in square brackets: <</array [contents]>>

For example; in the basic FDF file displayed above, the /Fields array contains nine dictionary objects.