officefileapi-devexpress-dot-pdf-dot-pdftextformfield-d273482a.md
Specifies text form field’s input type.
Namespace : DevExpress.Pdf
Assembly : DevExpress.Pdf.v25.2.Core.dll
NuGet Package : DevExpress.Pdf.Core
public PdfTextFieldInputType InputType { get; set; }
Public Property InputType As PdfTextFieldInputType
| Type | Description |
|---|---|
| PdfTextFieldInputType |
An enumeration value that indicates the input type.
|
Available values:
| Name | Description |
|---|---|
| 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.
|
The code sample below retrieves the text form field by name and changes its 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 text field properties:
PdfTextFormField addressFormField = (PdfTextFormField)acroForm.GetFormField("Address");
addressFormField.Multiline = false;
addressFormField.InputType = PdfTextFieldInputType.PlainText;
}
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