pdftools_toolbox.pdf.forms.list_box

Classes

ListBox(handle)

A list box field

class pdftools_toolbox.pdf.forms.list_box.ListBox(handle)[source]

Bases: ChoiceField

A list box field

static create(target_document: Document) ListBox[source]

Create a list 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 list box field

Return type:

pdftools_toolbox.pdf.forms.list_box.ListBox

Raises:
property allow_multi_select: bool

Allow multiple items to be selected

Returns:

bool

Raises:

StateError – if the object has already been closed

property chosen_items: ChoiceItemList

The selected choice items

Adding to this list results in an error:

  • IllegalState - if the list has already been closed - if the choice field is marked a read-only - if this list is not empty and the list box field is not marked as multi-select - if the choice field has widgets

  • UnsupportedOperation if the document is read-only

  • IllegalArgument - if the given choice item is None - if the given choice item has already been closed - if the given choice item is already present in this list - if the given choice item does not belong to the list box field’s choice items

Removing items or clearing the list results in an IllegalState error if the form field is marked as read-only, or if it has widgets.

Returns:

pdftools_toolbox.pdf.forms.choice_item_list.ChoiceItemList

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