.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

PdfViewerExtensions.Import(IPdfViewer, String, PdfFormDataFormat) Method

Imports interactive form data from the specified file with the specified form data format. This is an extension method.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Docs.v21.1.dll

Declaration

public static void Import(
    this IPdfViewer viewer,
    string fileName,
    PdfFormDataFormat format
)

Parameters

Name Type Description
viewer IPdfViewer

A PdfViewer or PdfViewerControl object that implements the IPdfViewer interface.

fileName String

A String, specifying the path to the file from which the interactive form data should be imported.

format PdfFormDataFormat

A PdfFormDataFormat enumeration value that lists formats for PDF form data values.

Remarks

See Export and Import Interactive Form Data (WinForms PDF Viewer) and Export and Import of Interactive Form Data (WPF PDF Viewer) topics to learn more.

Example

Important

The Universal Subscription or an additional Office File API Subscription is required to use this example in production code. Refer to the DevExpress Subscription page for pricing information.

This example demonstrates how to import AcroForm data (interactive form data) from XML format to a PDF document.

You can also import the AcroForm data from FDF, XFDF, and TXT formats, as described below.

To import interactive forms from XML format:

  • load an interactive forms document (e.g., from a file path), in which the data will be imported, into the PDF Viewer using the PdfViewer.LoadDocument method;
  • call one of the PdfViewerExtensions.Import overloaded methods, for example, with a specified XML file that contains imported data.

Note

You may need to add the DevExpress.Docs reference to your application to access the PdfViewer.Import extension methods.

using System.Windows.Forms;
using DevExpress.Pdf;

namespace ImportAcroForm {
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();

            // Load a PDF document with AcroForm data.
            pdfViewer1.LoadDocument("..\\..\\InitialAcroForm.pdf");

            // Import the document from an XML format. 
            pdfViewer1.Import("..\\..\\FilledAcroForm.xml");

            // Save the imported document.
            pdfViewer1.SaveDocument("..\\..\\ImportedAcroForm.pdf");
        }
    }
}
See Also