officefileapi-devexpress-dot-pdf-78cba0de.md
Represents a text field on a PDF form.
Namespace : DevExpress.Pdf
Assembly : DevExpress.Pdf.v25.2.Core.dll
NuGet Package : DevExpress.Pdf.Core
public class PdfTextFormField :
PdfInteractiveFormField
Public Class PdfTextFormField
Inherits PdfInteractiveFormField
A text field allows the user to enter text, such as name, address, or phone number.
The code sample below retrieves 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
Object DevExpress.Pdf.Native.PdfDocumentItem DevExpress.Pdf.Native.PdfObject PdfInteractiveFormField PdfTextFormField
See Also