PdfListField
12 Sep 20254 minutes to read
Represents the base class for list box and combo box fields.
// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data);
// Gets the first page of the document
let page: PdfPage = document.getPage(0);
// Access the PDF form
let form: PdfForm = document.form;
// Access the combo box field
let comboBoxField: PdfListField = form.fieldAt(0) as PdfListField;
// Gets the count of the loaded combo box field items.
let comboItemsCount: number = comboBoxField.itemsCount;
// Access the list box field
let listBoxField: PdfListField = form.fieldAt(1) as PdfListField;
// Gets the count of the loaded list box field items.
let ListItemsCount: number = listBoxField.itemsCount;
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();Properties
backColor number[]
Gets the background color of the field.
border PdfInteractiveBorder
Gets the width, style and dash of the border of the field.
borderColor number[]
Gets the border color of the field.
bounds Object
Gets the bounds.
color number[]
Gets the fore color of the field.
editable boolean
Gets the flag indicates whether the list field is editable.
export boolean
Gets a value indicating whether the field is allow to export data or not.
flatten boolean
Gets the boolean flag indicating whether the form field have been flattened or not.
font PdfFont
Gets the font of the field.
form PdfForm
Gets the form object of the field (Read only).
itemsCount number
Gets the count of the loaded field items (Read only).
mappingName string
Gets the mapping name to be used when exporting interactive form field data from the document.
multiSelect boolean
Gets the flag indicates whether the list field allows multiple selections.
name string
Gets the name of the field (Read only).
page PdfPage
Gets the page object of the form field (Read only).
readOnly boolean
Gets a value indicating whether read only.
required boolean
Gets a value indicating whether the field is required.
rotate number
Gets the rotation angle of the field.
rotationAngle PdfRotationAngle
Gets the rotation of the field (Read only).
selectedIndex number | number[]
Gets the selected item index or indexes.
selectedValue string | string[]
Gets the selected item value or values.
tabIndex number
Gets the tab index of annotation in current page.
textAlignment PdfTextAlignment
Gets the text alignment in a combo box field.
toolTip string
Gets the tool tip of the form field.
visibility PdfFormFieldVisibility
Gets the form field visibility.
visible boolean
Gets a value indicating the visibility of the field (Read only).
Methods
addItem
Add list item.
| Parameter | Type | Description |
|---|---|---|
| item | PdfListFieldItem |
Item to add. |
Returns number
getValue
Gets the value associated with the specified key.
| Parameter | Type | Description |
|---|---|---|
| name | string |
Key. |
Returns string
itemAt
Gets the item at the specified index.
| Parameter | Type | Description |
|---|---|---|
| index | number |
Index of the field item. |
Returns PdfListFieldItem
removeItem
Remove the list item.
| Parameter | Type | Description |
|---|---|---|
| item | PdfListFieldItem |
Item to remove. |
Returns void
removeItemAt
Remove the list item from the specified index.
| Parameter | Type | Description |
|---|---|---|
| index | number |
Item index to remove. |
Returns void
setAppearance
Sets the flag to indicate the new appearance creation.
| Parameter | Type | Description |
|---|---|---|
| value | boolean |
Set appearance. |
Returns void
setValue
Sets the value associated with the specified key.
| Parameter | Type | Description |
|---|---|---|
| name | string |
Key. |
| value | string |
Value associated with the key.. |
Returns void