Back to Devexpress

PdfAcroFormFacade.GetTextFormField(String) Method

officefileapi-devexpress-dot-pdf-dot-pdfacroformfacade-dot-gettextformfield-x28-system-dot-string-x29.md

latest4.8 KB
Original Source

PdfAcroFormFacade.GetTextFormField(String) Method

Gets a specific text form field’s properties.

Namespace : DevExpress.Pdf

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

NuGet Package : DevExpress.Pdf.Core

Declaration

csharp
public PdfTextFormFieldFacade GetTextFormField(
    string fullName
)
vb
Public Function GetTextFormField(
    fullName As String
) As PdfTextFormFieldFacade

Parameters

NameTypeDescription
fullNameString

The form field name.

|

Returns

TypeDescription
PdfTextFormFieldFacade

An object that contains the form field properties.

|

Remarks

The PdfTextFormFieldFacade object contains form field and widget properties without access to the form field’s inner structure. Use the Widgets property to get the form field widgets’ settings.

The code sample below divides one form field into equally spaced positions (combs) and enables multiline text in the other form field:

csharp
using (PdfDocumentProcessor pdfDocumentProcessor = new PdfDocumentProcessor())
{
    pdfDocumentProcessor.LoadDocument("Documents//FormDemo.pdf");

    PdfDocumentFacade documentFacade = pdfDocumentProcessor.DocumentFacade;
    PdfAcroFormFacade acroForm = documentFacade.AcroForm;
    PdfTextFormFieldFacade visaField = acroForm.GetTextFormField("VisaNo");

    //Divide field text into equally spaced positions:
    visaField.InputType = PdfTextFieldInputType.Comb;
    visaField.Multiline = false;

    //Limit the number of inserted characters:
    visaField.MaxLength = 8;

    //Enable multiline text in the text field:
    PdfTextFormFieldFacade addressField = acroForm.GetTextFormField("Address");
    addressField.Multiline = true;

    addressField.Scrollable = true;
    addressField.SpellCheck = false;
    pdfDocumentProcessor.SaveDocument("FormDemo_new.pdf");
}
vb
Using pdfDocumentProcessor As New PdfDocumentProcessor()
  pdfDocumentProcessor.LoadDocument("Documents//FormDemo.pdf")

  Dim documentFacade As PdfDocumentFacade = pdfDocumentProcessor.DocumentFacade
  Dim acroForm As PdfAcroFormFacade = documentFacade.AcroForm
  Dim visaField As PdfTextFormFieldFacade = acroForm.GetTextFormField("VisaNo")

  'Divide field text into equally spaced positions:
  visaField.InputType = PdfTextFieldInputType.Comb
  visaField.Multiline = False

  'Limit the number of inserted characters:
  visaField.MaxLength = 8

  'Enable multiline text in the text field:
  Dim addressField As PdfTextFormFieldFacade = acroForm.GetTextFormField("Address")
  addressField.Multiline = True

  addressField.Scrollable = True
  addressField.SpellCheck = False
  pdfDocumentProcessor.SaveDocument("FormDemo_new.pdf")
End Using

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetTextFormField(String) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

pdf-document-api-fill-interactive-form-fields/CS/PdfFormFilling/PdfFormFilling.cs#L53

csharp
PdfTextFormFieldFacade nameField = acroForm.GetTextFormField("FirstName");
nameField.Value = "Janet";

pdf-document-api-fill-interactive-form-fields/VB/PdfFormFilling/PdfFormFilling.vb#L47

vb
Dim nameField As PdfTextFormFieldFacade = acroForm.GetTextFormField("FirstName")
nameField.Value = "Janet"

See Also

PdfAcroFormFacade Class

PdfAcroFormFacade Members

DevExpress.Pdf Namespace