pdftools_toolbox.pdf.forms.combo_box

Classes

ComboBox(handle)

A combo box field

class pdftools_toolbox.pdf.forms.combo_box.ComboBox(handle)[source]

Bases: ChoiceField

A combo box field

static create(target_document: Document) ComboBox[source]

Create a combo box form field

The returned form field object is not yet used, but it is associated with the given target document.

Parameters:

targetDocument (pdftools_toolbox.pdf.document.Document) – the output document with which the returned object is associated

Returns:

the newly created combo box field

Return type:

pdftools_toolbox.pdf.forms.combo_box.ComboBox

Raises:
property can_edit: bool

Has an editable item

Returns:

bool

Raises:

StateError – if the object has already been closed

property chosen_item: ChoiceItem | None

The selected combo box item

If this property is None then the pdftools_toolbox.pdf.forms.combo_box.ComboBox.editable_item_name is the selected value. Setting this property automatically sets pdftools_toolbox.pdf.forms.combo_box.ComboBox.editable_item_name to None.

Returns:

Optional[pdftools_toolbox.pdf.forms.choice_item.ChoiceItem]

Raises:

StateError – if the object has already been closed

property editable_item_name: str | None

The name of the editable item

This property is None if any of the combo box items is selected, i.e., if pdftools_toolbox.pdf.forms.combo_box.ComboBox.chosen_item is not None. Setting this property automatically sets pdftools_toolbox.pdf.forms.combo_box.ComboBox.chosen_item to None.

Returns:

Optional[str]

Raises:

StateError – if the object has already been closed

property font_size: float

The font size

If 0.0 is set, then the font size is chosen automatically by the PDF processor.

Returns:

float

Raises:

StateError – if the object has already been closed