Skip to main content
A newer version of this page is available. .

Export and Import of Interactive Form Data

  • 3 minutes to read

This document describes how to export and import AcroForm data (interactive forms that contain PDF fields for gathering information interactively from the user) in FDF and XML formats.

The document consists of the following sections:

Prerequisite

Before exporting/importing AcroForm data, make sure you performed the following prerequisite actions:

  • Add a PDF Viewer to the WPF application. To learn more, see How to: Add a PDF Viewer at Design Time and How to: Add a PDF Viewer via Code tutorials.
  • Load a document that contains interactive forms. See the Lesson 2 - Loading a Document tutorial.

    Note

    If a PDF document does not contain an interactive form, then the Interactive Form tab does not appear in the ribbon.

    In this tutorial, the FormDemo.pdf with interactive forms is used. To access this document, copy the file to the subdirectory of your project. By default, this file is located in the following folder.

    C:\Users\Public\Documents\DevExpress Demos 18.2\Components\Data\FormDemo.pdf

Export/Import using the PDF Viewer’s toolbar

The PDF Viewer’s toolbar creation is detailed in the corresponding section of the Lesson 1 - Creating a PDF Viewer lesson.

Export

To export interactive form data from a PDF document to one of supported formats:

  • Click the Export button in the Form Data tab of the PDF Viewer’s toolbar.

    PDFExportForms

    The dialog appears.

    ExportSaveAsDialog

    In this dialog, you specify a file name, and the format in which the interactive form data should be exported (FDF, or XML). To export a document, click Save, as shown above.

Import

To import interactive form data from FDF and XML to a PDF document:

  • Click the Import button on the PDF toolbar.

    ImportFormData

  • This invokes the dialog box, where you can choose a file with interactive forms (e.g., in the FDF format) to import data. To perform import, click Open.

    ImportFormOpen

  • The imported interactive form data will be shown in the PDF Viewer.

    ImportedForm

Export/Import via Code

Export

To export interactive form data from a PDF document to XML or FDF format, call the PdfViewerControl.ExportFormData method in the PdfViewerControl.DocumentLoaded event handler.

This method invokes the Save As dialog window, where you can specify the desired file format (XML or FDF) and a file name to export interactive form data.

For more details, see the How to: Export the AcroForm Data example.

Import

To import AcroForm data either from XML or FDF format to a PDF document, call the PdfViewerControl.ImportFormData after the document is loaded in the PdfViewerControl.DocumentLoaded event handler.

The method invokes the Open dialog window, where you can specify a file name and file format (XML or FDF) from which a PDF document with interactive form is loaded.

The How to: Import the AcroForm Data example shows the AcroForm data import in action.