Table of Contents

Class PdfListFieldItem

Namespace
Syncfusion.Pdf.Interactive
Assembly
Syncfusion.Pdf.Portable.dll

Represents an item of the list fields.

public class PdfListFieldItem
Inheritance
PdfListFieldItem
Inherited Members

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();                       
PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12f);
//Create list box
PdfListBoxField listBox = new PdfListBoxField(page, "list1");
//Add the field to list box.
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;
//Gets the selected item
PdfListFieldItem selectedItem = listBox.SelectedItem;
MessageBox.Show("Selected Item text : " + selectedItem.Text);
MessageBox.Show("Selected Item value : " + selectedItem.Value);
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()
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12f)
'Create list box
Dim listBox As PdfListBoxField = New PdfListBoxField(page, "list1")
'Add the field to list box.
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
'Gets the selected item
Dim selectedItem As PdfListFieldItem = listBox.SelectedItem
MessageBox.Show("Selected Item text : " + selectedItem.Text)
MessageBox.Show("Selected Item value : " + selectedItem.Value)
document.Save("Form.pdf")
document.Close(True)

Constructors

PdfListFieldItem()

Initializes a new instance of the PdfListFieldItem class.

public PdfListFieldItem()
See Also

PdfListFieldItem(string, string)

Initializes a new instance of the PdfListFieldItem class with the specific text and value.

public PdfListFieldItem(string text, string value)

Parameters

text string

The item text, it is displayed in the list.

value string

The item value, it is exported when form content is exported.

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();                       
PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12f);
//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;
//Gets the selected item
PdfListFieldItem selectedItem = listBox.SelectedItem;
MessageBox.Show("Selected Item text : " + selectedItem.Text);
MessageBox.Show("Selected Item value : " + selectedItem.Value);
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()
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12f)
'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
'Gets the selected item
Dim selectedItem As PdfListFieldItem = listBox.SelectedItem
MessageBox.Show("Selected Item text : " + selectedItem.Text)
MessageBox.Show("Selected Item value : " + selectedItem.Value)
document.Save("Form.pdf")
document.Close(True)
See Also

Properties

Text

Gets or sets the text.

public string Text { get; set; }

Property Value

string

The text of the list item field.

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();               
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;
//Gets the selected item
PdfListFieldItem selectedItem = listBox.SelectedItem;
MessageBox.Show("Selected Item text : " + selectedItem.Text);
MessageBox.Show("Selected Item value : " + selectedItem.Value);
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()
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12f)
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
'Gets the selected item
Dim selectedItem As PdfListFieldItem = listBox.SelectedItem
MessageBox.Show("Selected Item text : " + selectedItem.Text)
MessageBox.Show("Selected Item value : " + selectedItem.Value)
document.Save("Form.pdf")
document.Close(True)
See Also

Value

Gets or sets the value.

public string Value { get; set; }

Property Value

string

The value of the list item field.

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();               
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;
//Gets the selected item
PdfListFieldItem selectedItem = listBox.SelectedItem;
MessageBox.Show("Selected Item text : " + selectedItem.Text);
MessageBox.Show("Selected Item value : " + selectedItem.Value);
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()
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12f)
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
'Gets the selected item
Dim selectedItem As PdfListFieldItem = listBox.SelectedItem
MessageBox.Show("Selected Item text : " + selectedItem.Text)
MessageBox.Show("Selected Item value : " + selectedItem.Value)
document.Save("Form.pdf")
document.Close(True)
See Also

See Also