[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Collapse]Office File API
  Demo Application
  Redistribution and Deployment
 [Expand]Spreadsheet Document API
 [Expand]Word Processing Document API
 [Collapse]PDF Document API
   Getting Started
   Coordinate Systems
   Document Generation
  [Expand]PDF Graphics
  [Expand]Document Manipulation
  [Expand]Additional Content
  [Collapse]Interactive Forms
    Interactive Form Filling
    Interactive Form Flattening
    Creating Interactive Form
    Deleting Interactive Form
    Export and Import Interactive Form Data
  [Expand]Text Markup Annotations
  [Expand]Document Security
  [Expand]Examples
 [Expand]Excel Export Library
 [Expand]Snap Report API
 [Expand]Zip Compression and Archive API
 [Expand]Barcode Generation API
 [Expand]Unit Conversion API
 [Expand]API Reference
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Interactive Form Filling

This topic describes different ways of interactive form filling.

This document consists of the following sections:

Expanded Filling of an Interactive Form using Form Field Names

To load a PDF document that contains an interactive form, create an instance of the PdfDocumentProcessor object and call one of the PdfDocumentProcessor.LoadDocument overloaded methods.

Calling the PdfDocumentProcessor.GetFormData method acquires the interactive form data from a PDF document. This method returns a PdfFormData object that represents interactive form data.

Note

Do not use a previously obtained PdfFormData instance after the interactive form structure is changed. For example, after one of the following operations is applied: adding new interactive form fields, interactive form flattening, merging documents with interactive forms, or deleting pages with interactive form fields. You can obtain the new PdfFormData instance by calling the PdfDocumentProcessor.GetFormData method.

To set or update interactive form field values, provide the field name as a key (e.g., data[“FieldName1”].Value = “SomeValue1”).

To specify a value for a form field, use the PdfFormData.Value property.

Important

The value specified for an interactive form field can be a string for text fields, a name of the checked/unchecked appearance for radio buttons and check boxes, an array of strings (for multi select fields) or a PdfFormData object (for the complex fields for which the field name is provided as a key).

When all values have been set, call the PdfDocumentProcessor.ApplyFormData method to apply form data to the interactive form.

Call one of the PdfDocumentProcessor.SaveDocument overloaded methods to commit these changes to a PDF document.

See the code snippet below.

Tip

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=T210253.

If required, you can easily retrieve a list of field name by iterating through the string collection returned by the PdfDocumentProcessor.GetFormFieldNames method.

Expanded Filling of an Interactive Form using Data File

If you have a file with interactive form data (Fdf, Xml, Xfdf or Txt), you can fill the PdfFormData object directly from this file. To do this, pass the name of the data file and format when creating a PdfFormData object.

Note

If you omit the data format parameter, the PDF Document API component automatically detects this type.

See the code snippet below.

Expanded See Also

Is this topic helpful?​​​​​​​