Syncfusion AI Assistant

How can I help you?

Form Filling in .NET MAUI PDF Viewer (SfPdfViewer)

25 Mar 20263 minutes to read

The .NET MAUI PDF Viewer SfPdfViewer enables users to view and fill AcroForm-based PDF forms across mobile and desktop apps. It supports interactive form filling through the built-in UI, and developers can access and modify form data programmatically using the FormFields API.

The viewer supports saving filled forms, flattening form fields to make them non-editable, and importing or exporting form data in FDF, XFDF, JSON, and XML formats. These capabilities make the viewer ideal for capturing and handling form data efficiently within your application.

Supported form field types

Field Type Description
Text box Accepts free-form text input from the user.
Checkbox Allows the user to toggle a true/false selection.
Radio button Allows the user to select one option from a group.
Combo box Presents a dropdown list for single-item selection.
List box Presents a scrollable list supporting single or multi-selection.
Signature Captures a handwritten, text, or image signature.
Button Renders a button; supports GoTo navigation actions only.

XFA forms are not supported

The PDF viewer supports only Acroforms. PDF documents that contain an XFA form cannot be loaded in the PDF Viewer. When a PDF with an XFA form is attempted to be loaded, the DocumentLoadFailed event is raised.

private void PdfViewer_DocumentLoadFailed(object sender, DocumentLoadFailedEventArgs e)
{
    if (e.Message == "This PDF cannot be loaded because it contains XFA form.")
    {
        // Handle XFA loading failure.
    }
}

Refer to Handling document load failures for more details.

In this section

Topic Description
Form Fields Collection Access the FormFields collection, restrict editing, clear form data, and attach custom data to fields.
Edit Form Fields Programmatically set values for text, checkbox, combo box, list box, radio button, and signature fields.
Show and Hide Form Fields Control form field visibility using the IsHidden property.
Customize Form Fields Modify background color, text color, border color, and border width of form field widgets.
Form Field Events Track value changes and focus changes on form fields using events.
Import and Export Form Data Import and export form data in XFDF, FDF, JSON, and XML formats.
Form Data Validation Validate form field values before saving the document.

See Also