Import Form Data Action

The ImportFormDataAction can be used with the Document class (creating PDF documents) or the MergeDocument class (merging/modifying existing PDF documents).

ImportFormDataAction

An FDF file is a text file format used for data exported from PDF form fields that contain only form field data, not a complete form. An AcroForm's fields can be completed using an FDF file through the ImportFormDataAction class.

The following example illustrates using an FDF file. Note that the completed PDF form is the form with the added action to import the FDF data upon the end-user opening the PDF.

The following FDF data is used to fill the form.

%FDF-1.2
%âãÏÓ
1 0 obj
<</FDF<</Fields[<</T(Submit)>><</T(descriptionField)/V(This is a description.)>><</T(nameField)/V(John Doe)>>]/ID[<CA4420574740BBED8326F4582D61BF85><CA4420574740BBED8326F4582D61BF85>]>>/Type/Catalog>>
endobj
trailer
<</Root 1 0 R>>
%%EOF

The path to the FDF file must be accessible to the end-user of the form.

MergeDocument document = new MergeDocument("simple-form-fill.pdf");
document.Pages[0].ReaderEvents.Open = new ImportFormDataAction("simple-form-fill_data.fdf");
document.Draw(outputPath);    
Dim document As New MergeDocument("simple-form-fill.pdf")
document.Pages(0).ReaderEvents.Open = New ImportFormDataAction("simple-form-fill_data.fdf")
document.Draw(outputPath)

form filling Figure 1. Completing a form with FDF data.

In this topic