Back to Devexpress

PdfTextFormField.InputType Property

officefileapi-devexpress-dot-pdf-dot-pdftextformfield-d273482a.md

latest3.2 KB
Original Source

PdfTextFormField.InputType Property

Specifies text form field’s input type.

Namespace : DevExpress.Pdf

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

NuGet Package : DevExpress.Pdf.Core

Declaration

csharp
public PdfTextFieldInputType InputType { get; set; }
vb
Public Property InputType As PdfTextFieldInputType

Property Value

TypeDescription
PdfTextFieldInputType

An enumeration value that indicates the input type.

|

Available values:

NameDescription
PlainText

The field value is a plain text string.

| | RichText |

The field value is a rich text string.

| | Password |

The field value is a password.

| | FileSelect |

The field value is a path to a file.

| | Comb |

The field is divided into equally spaced positions or combs. The PdfTextFormField.MaxLen or PdfTextFormFieldFacade.MaxLength property defines the number of available characters.

|

Remarks

The code sample below retrieves the text form field by name and changes its properties:

csharp
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 text field properties:
      PdfTextFormField addressFormField = (PdfTextFormField)acroForm.GetFormField("Address");
      addressFormField.Multiline = false;
      addressFormField.InputType = PdfTextFieldInputType.PlainText;
  }
vb
Using pdfDocumentProcessor As New PdfDocumentProcessor()
  pdfDocumentProcessor.LoadDocument("FormDemo.pdf")
  ChangeFormFields(pdfDocumentProcessor)
  pdfDocumentProcessor.SaveDocument("FormDemo.pdf")
  Process.Start(New ProcessStartInfo("FormDemo.pdf") With {.UseShellExecute = True})
End Using

  private static void ChangeFormFields(PdfDocumentProcessor pdfDocumentProcessor)
    Dim acroForm As PdfInteractiveForm = pdfDocumentProcessor.Document.AcroForm

    'Change text field properties:
    Dim addressFormField As PdfTextFormField = CType(acroForm.GetFormField("Address"), PdfTextFormField)
    addressFormField.Multiline = False
    addressFormField.InputType = PdfTextFieldInputType.PlainText

    End Sub

See Also

PdfTextFormField Class

PdfTextFormField Members

DevExpress.Pdf Namespace