Skip to main content

Export and Import 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 a user) in various formats - FDF, XFDF, XML, and TXT.

Prerequisites

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

  • Add the PDF Viewer to a WinForms application and load a document. To learn more, see the Get Started with WinForms PDF Viewer 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 your project subdirectory. This file is located in the following folder by default:

    C:\Users\Public\Documents\DevExpress Demos 23.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 Getting Started topic.

Export

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

  • Click the Export button on the PDF Viewer’s toolbar (you can find this button in the Interactive Form tab of the Ribbon toolbar).

    ExportAcroForms

    The Save As dialog appears.

    ExportAcroForm_SaveAs

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

Import

To import interactive form data from FDF, XFDF, XML or TXT to a PDF document:

  • Click the Import button on the PDF toolbar (you can find this button in the Interactive Form tab of the Ribbon toolbar).

    ImportAcroFormData

  • This invokes the Open dialog box, where you can select a file with interactive forms (for example, in FDF) to import data. To perform the import, click Open.

    OpenAcroFormData

  • The imported interactive form data shows in a PDF document.

    ImportedAcroForm

Export/Import via extension methods

You can access extension methods by adding the DevExpress.Docs reference to your application.

Important

The Universal Subscription or an additional Office File API Subscription is required to use extension methods in production code. Please refer to the DevExpress Subscription page for pricing information.

To export interactive form data from a PDF document to one of the supported formats, call one of the PdfViewerExtensions.Export overloaded methods with the specified data format settings.

To import AcroForm data, call one of the PdfViewerExtensions.Import overloaded methods with data format settings or without them.

The PdfFormDataFormat enumeration lists the supported data formats.

Examples

The following examples show how to export and import interactive form data:

See Also