officefileapi-devexpress-dot-pdf-dfa45482.md
Represents a choice field (a combo box, list box) on a PDF form.
Namespace : DevExpress.Pdf
Assembly : DevExpress.Pdf.v25.2.Core.dll
NuGet Package : DevExpress.Pdf.Core
public class PdfChoiceFormField :
PdfInteractiveFormField
Public Class PdfChoiceFormField
Inherits PdfInteractiveFormField
The code sample below retrieves a combo box 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)
{
//Change combo box field properties:
PdfChoiceFormField nationalityFormField = (PdfChoiceFormField)acroForm.GetFormField("Nationality");
nationalityFormField.Editable = false;
nationalityFormField.MultiSelect = false;
}
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 combo box field properties:
Dim nationalityFormField As PdfChoiceFormField = CType(acroForm.GetFormField("Nationality"), PdfChoiceFormField)
nationalityFormField.Editable = False
nationalityFormField.MultiSelect = False
End Sub
Object DevExpress.Pdf.Native.PdfDocumentItem DevExpress.Pdf.Native.PdfObject PdfInteractiveFormField PdfChoiceFormField
See Also