menu

Document Processing

PdfListField Class - C# PDF Library API Reference | Syncfusion

    Show / Hide Table of Contents

    PdfListField Class

    Represents base class for form's list fields.

    Inheritance
    System.Object
    PdfField
    PdfStyledField
    PdfAppearanceField
    PdfListField
    PdfComboBoxField
    PdfListBoxField
    Implements
    System.ComponentModel.INotifyPropertyChanged
    Inherited Members
    PdfAppearanceField.Appearance
    PdfAppearanceField.DrawAppearance(PdfTemplate)
    PdfField.DisableAutoFormat
    PdfField.Export
    PdfField.Flatten
    PdfField.Form
    PdfField.GetValue(String)
    PdfField.Layer
    PdfField.MappingName
    PdfField.Name
    PdfField.Page
    PdfField.PdfTag
    PdfField.PropertyChanged
    PdfField.ReadOnly
    PdfField.Required
    PdfField.SetValue(String, String)
    PdfField.TabIndex
    PdfField.ToolTip
    PdfStyledField.Actions
    PdfStyledField.BackColor
    PdfStyledField.BorderColor
    PdfStyledField.BorderStyle
    PdfStyledField.BorderWidth
    PdfStyledField.Bounds
    PdfStyledField.DefineDefaultAppearance()
    PdfStyledField.Font
    PdfStyledField.ForeColor
    PdfStyledField.HighlightMode
    PdfStyledField.Location
    PdfStyledField.ObtainFont()
    PdfStyledField.RotationAngle
    PdfStyledField.Size
    PdfStyledField.TextAlignment
    PdfStyledField.Visibility
    PdfStyledField.Visible
    Namespace: Syncfusion.Pdf.Interactive
    Assembly: Syncfusion.Pdf.Base.dll
    Syntax
    public abstract class PdfListField : PdfAppearanceField, IPdfWrapper, INotifyPropertyChanged

    Constructors

    PdfListField(PdfPageBase, String)

    Initializes a new instance of the PdfListField class with the specific page and name.

    Declaration
    public PdfListField(PdfPageBase page, string name)
    Parameters
    Type Name Description
    PdfPageBase page

    Page which the field to be placed on.

    System.String name

    The name of the field.

    Properties

    Items

    Gets the list field items.[Read-Only]

    Declaration
    public PdfListFieldItemCollection Items { get; }
    Property Value
    Type Description
    PdfListFieldItemCollection

    The items.

    Examples
    //Create a new PDf document
    PdfDocument document = new PdfDocument();           
    //Creates a new page and adds it as the last page of the document
    PdfPage page = document.Pages.Add();                         
    //Create list box
    PdfListBoxField listBox = new PdfListBoxField(page, "list1");
    //Add the field to listbox.
    document.Form.Fields.Add(listBox);            
    //Set the properties.
    listBox.Bounds = new RectangleF(100, 350, 100, 50);
    listBox.HighlightMode = PdfHighlightMode.Outline;            
    // Creates list items
    PdfListFieldItemCollection itemCollection = listBox.Items;
    //Add the items to the list box
    itemCollection.Add(new PdfListFieldItem("English", "English"));
    itemCollection.Add(new PdfListFieldItem("French", "French"));
    itemCollection.Add(new PdfListFieldItem("German", "German"));
    listBox.SelectedIndex = 0;            
    document.Save("Form.pdf");
    document.Close(true);
    'Create a new PDf document
    Dim document As PdfDocument = New PdfDocument()
    'Create a page
    Dim page As PdfPage = document.Pages.Add()
    'Create list box
    Dim listBox As PdfListBoxField = New PdfListBoxField(page, "list1")
    'Add the field to listbox.
    document.Form.Fields.Add(listBox)
    'Set the properties.
    listBox.Bounds = New RectangleF(100, 350, 100, 50)
    listBox.HighlightMode = PdfHighlightMode.Outline
    ' Creates list items
    Dim itemCollection As PdfListFieldItemCollection = listBox.Items
    'Add the items to the list box
    itemCollection.Add(New PdfListFieldItem("English", "English"))
    itemCollection.Add(New PdfListFieldItem("French", "French"))
    itemCollection.Add(New PdfListFieldItem("German", "German"))
    listBox.SelectedIndex = 0
    document.Save("Form.pdf")
    document.Close(True)
    See Also
    PdfCollection
    Syncfusion.Pdf.IPdfWrapper
    PdfDocument
    PdfPage
    PdfListBoxField

    SelectedIndex

    Gets or sets the first selected item in the list.

    Declaration
    public int SelectedIndex { get; set; }
    Property Value
    Type Description
    System.Int32

    The index of the selected item.

    Examples
    //Create a new PDf document
    PdfDocument document = new PdfDocument();           
    //Creates a new page and adds it as the last page of the document
    PdfPage page = document.Pages.Add();                         
    //Create list box
    PdfListBoxField listBox = new PdfListBoxField(page, "list1");
    //Add the field to listbox.
    document.Form.Fields.Add(listBox);            
    //Set the properties.
    listBox.Bounds = new RectangleF(100, 350, 100, 50);
    listBox.HighlightMode = PdfHighlightMode.Outline;            
    // Creates list items
    PdfListFieldItemCollection itemCollection = listBox.Items;
    //Add the items to the list box
    itemCollection.Add(new PdfListFieldItem("English", "English"));
    itemCollection.Add(new PdfListFieldItem("French", "French"));
    itemCollection.Add(new PdfListFieldItem("German", "German"));
    //Set the first selected item in the list. 
    listBox.SelectedIndex = 0;            
    document.Save("Form.pdf");
    document.Close(true);
    'Create a new PDf document
    Dim document As PdfDocument = New PdfDocument()
    'Create a page
    Dim page As PdfPage = document.Pages.Add()
    'Create list box
    Dim listBox As PdfListBoxField = New PdfListBoxField(page, "list1")
    'Add the field to listbox.
    document.Form.Fields.Add(listBox)
    'Set the properties.
    listBox.Bounds = New RectangleF(100, 350, 100, 50)
    listBox.HighlightMode = PdfHighlightMode.Outline
    ' Creates list items
    Dim itemCollection As PdfListFieldItemCollection = listBox.Items
    'Add the items to the list box
    itemCollection.Add(New PdfListFieldItem("English", "English"))
    itemCollection.Add(New PdfListFieldItem("French", "French"))
    itemCollection.Add(New PdfListFieldItem("German", "German"))
    'Set the first selected item in the list. 
    listBox.SelectedIndex = 0
    document.Save("Form.pdf")
    document.Close(True)
    See Also
    PdfCollection
    Syncfusion.Pdf.IPdfWrapper
    PdfDocument
    PdfPage
    PdfListBoxField

    SelectedItem

    Gets the first selected item in the list.[Read-Only]

    Declaration
    public PdfListFieldItem SelectedItem { get; }
    Property Value
    Type Description
    PdfListFieldItem

    The selected item.

    Examples
    //Create a new PDf document
    PdfDocument document = new PdfDocument();           
    //Creates a new page and adds it as the last page of the document
    PdfPage page = document.Pages.Add();                         
    //Create list box
    PdfListBoxField listBox = new PdfListBoxField(page, "list1");
    //Add the field to listbox.
    document.Form.Fields.Add(listBox);            
    //Set the properties.
    listBox.Bounds = new RectangleF(100, 350, 100, 50);
    listBox.HighlightMode = PdfHighlightMode.Outline;            
    // Creates list items
    PdfListFieldItemCollection itemCollection = listBox.Items;
    //Add the items to the list box
    itemCollection.Add(new PdfListFieldItem("English", "English"));
    itemCollection.Add(new PdfListFieldItem("French", "French"));
    itemCollection.Add(new PdfListFieldItem("German", "German"));
    //Get the first selected item in the list.
    PdfListFieldItem selectedItem = listBox.SelectedItem;  
    document.Save("Form.pdf");
    document.Close(true);
    'Create a new PDf document
    Dim document As PdfDocument = New PdfDocument()
    'Create a page
    Dim page As PdfPage = document.Pages.Add()
    'Create list box
    Dim listBox As PdfListBoxField = New PdfListBoxField(page, "list1")
    'Add the field to listbox.
    document.Form.Fields.Add(listBox)
    'Set the properties.
    listBox.Bounds = New RectangleF(100, 350, 100, 50)
    listBox.HighlightMode = PdfHighlightMode.Outline
    ' Creates list items
    Dim itemCollection As PdfListFieldItemCollection = listBox.Items
    'Add the items to the list box
    itemCollection.Add(New PdfListFieldItem("English", "English"))
    itemCollection.Add(New PdfListFieldItem("French", "French"))
    itemCollection.Add(New PdfListFieldItem("German", "German"))
    'Get the first selected item in the list.
    Dim selectedItem As PdfListFieldItem = listBox.SelectedItem
    document.Save("Form.pdf")
    document.Close(True)
    See Also
    PdfCollection
    Syncfusion.Pdf.IPdfWrapper
    PdfDocument
    PdfPage
    PdfListBoxField

    SelectedValue

    Gets or sets the value of the first selected item in the list.

    Declaration
    public string SelectedValue { get; set; }
    Property Value
    Type Description
    System.String

    The selected value.

    Examples
    //Create a new PDf document
    PdfDocument document = new PdfDocument();           
    //Creates a new page and adds it as the last page of the document
    PdfPage page = document.Pages.Add();                         
    //Create list box
    PdfListBoxField listBox = new PdfListBoxField(page, "list1");
    //Add the field to listbox.
    document.Form.Fields.Add(listBox);            
    //Set the properties.
    listBox.Bounds = new RectangleF(100, 350, 100, 50);
    listBox.HighlightMode = PdfHighlightMode.Outline;            
    // Creates list items
    PdfListFieldItemCollection itemCollection = listBox.Items;
    //Add the items to the list box
    itemCollection.Add(new PdfListFieldItem("English", "English"));
    itemCollection.Add(new PdfListFieldItem("French", "French"));
    itemCollection.Add(new PdfListFieldItem("German", "German"));
    //Set the value of the first selected item in the list.
    listBox.SelectedValue = "English";              
    document.Save("Form.pdf");
    document.Close(true);
    'Create a new PDf document
    Dim document As PdfDocument = New PdfDocument()
    'Create a page
    Dim page As PdfPage = document.Pages.Add()
    'Create list box
    Dim listBox As PdfListBoxField = New PdfListBoxField(page, "list1")
    'Add the field to listbox.
    document.Form.Fields.Add(listBox)
    'Set the properties.
    listBox.Bounds = New RectangleF(100, 350, 100, 50)
    listBox.HighlightMode = PdfHighlightMode.Outline
    ' Creates list items
    Dim itemCollection As PdfListFieldItemCollection = listBox.Items
    'Add the items to the list box
    itemCollection.Add(New PdfListFieldItem("English", "English"))
    itemCollection.Add(New PdfListFieldItem("French", "French"))
    itemCollection.Add(New PdfListFieldItem("German", "German"))
    'Set the value of the first selected item in the list.
    listBox.SelectedValue = "English"
    document.Save("Form.pdf")
    document.Close(True)
    See Also
    PdfCollection
    Syncfusion.Pdf.IPdfWrapper
    PdfDocument
    PdfPage
    PdfListBoxField

    Methods

    Initialize()

    Initializes an instance.

    Declaration
    protected override void Initialize()
    Overrides
    PdfStyledField.Initialize()

    Implements

    System.ComponentModel.INotifyPropertyChanged

    See Also

    PdfAppearanceField
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved