Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

PdfInteractiveForm.GetFormField(String) Method

Obtains the interactive form field by its name.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Pdf.v24.2.Core.dll

NuGet Package: DevExpress.Pdf.Core

#Declaration

public PdfInteractiveFormField GetFormField(
    string name
)

#Parameters

Name Type Description
name String

The form field name.

#Returns

Type Description
PdfInteractiveFormField

An interactive from field with the specified name.

#Remarks

The code sample below retrieves form fields by name and changes their properties:

using (PdfDocumentProcessor pdfDocumentProcessor = new PdfDocumentProcessor())
{
    pdfDocumentProcessor.LoadDocument("FormDemo.pdf");
    ChangeFormFields(pdfDocumentProcessor);
    pdfDocumentProcessor.SaveDocument("FormDemo.pdf");
    Process.Start(new ProcessStartInfo("FormDemo.pdf")
       { UseShellExecute = true });
}


  private static void ChangeFormFields(PdfDocumentProcessor pdfDocumentProcessor)
  {
      PdfInteractiveForm acroForm = pdfDocumentProcessor.Document.AcroForm;

      //Change radio group field properties:
      PdfButtonFormField genderFormField = (PdfButtonFormField)acroForm.GetFormField("Gender");
      genderFormField.ToggleToOff = true;

      //Change text field properties:
      PdfTextFormField addressFormField = (PdfTextFormField)acroForm.GetFormField("Address");
      addressFormField.Multiline = false;
      addressFormField.InputType = PdfTextFieldInputType.PlainText;

      //Change combo box field properties:
      PdfChoiceFormField nationalityFormField = (PdfChoiceFormField)acroForm.GetFormField("Nationality");
      nationalityFormField.Editable = false;
      nationalityFormField.MultiSelect = false;
  }
See Also