Represents a list box form field in a PDF document. List boxes display a scrollable list of options for selection.
from nutrient_sdk import PdfListBoxFieldInherits from: PdfFormField
Construction
PdfListBoxField cannot be instantiated directly. Obtain instances through static factory methods or via other SDK classes.
Methods
add_item
def add_item(self, text: str) -> Nonedef add_item(self, text: str, value: str) -> NoneAdds an item to the list box.
Parameters:
| Name | Type | Description |
|---|---|---|
text | str | The display text for the item. |
value (optional) | str | The export value for the item. |
Raises:
SdkException: Thrown when the operation fails.
remove_item_at
def remove_item_at(self, index: int) -> NoneRemoves an item from the list box at the specified index.
Parameters:
| Name | Type | Description |
|---|---|---|
index | int | The 0-based index of the item to remove. |
Raises:
IndexOutOfBoundsException: Thrown when index is out of range.SdkException: Thrown when the operation fails.
Properties
has_selection
@propertydef has_selection(self) -> boolWhether the list box has a value selected.
Type: bool
Read-only property.
item_count
@propertydef item_count(self) -> intThe number of items in the list box.
Type: int
Read-only property.
selected_value
@propertydef selected_value(self) -> str
@selected_value.setterdef selected_value(self, value: str) -> NoneThe currently selected value. For multi-select list boxes, this returns the first selected value.
Type: str
Inherited members
From PdfFormField: child, child_count, default_value, field_type, full_name, is_read_only, is_required, is_terminal, name, parent, value, widget, widget_count, remove_child_at