pdftools_toolbox.pdf.optional_content_group_list

Classes

OptionalContentGroupList(handle)

A list of pdftools_toolbox.pdf.optional_content_group.OptionalContentGroup objects (also know as layers).

class pdftools_toolbox.pdf.optional_content_group_list.OptionalContentGroupList(handle)[source]

Bases: _NativeObject, list

A list of pdftools_toolbox.pdf.optional_content_group.OptionalContentGroup objects (also know as layers). The list of optional content groups for a specific document can be retrieved using the pdftools_toolbox.pdf.document.Document.optional_content_groups .

clear() None[source]

Remove all items from list.

remove(index: int) None[source]

Remove first occurrence of value.

Raises ValueError if the value is not present.

extend(items: OptionalContentGroupList) None[source]

Extend list by appending elements from the iterable.

insert(index: int, value: Any) None[source]

Insert object before index.

pop(index: int = -1) Any[source]

Remove and return item at index (default last).

Raises IndexError if list is empty or index is out of range.

copy() OptionalContentGroupList[source]

Return a shallow copy of the list.

sort(key=None, reverse=False) None[source]

Sort the list in ascending order and return None.

The sort is in-place (i.e. the list itself is modified) and stable (i.e. the order of two equal elements is maintained).

If a key function is given, apply it once to each list item and sort them, ascending or descending, according to their function values.

The reverse flag can be set to sort in descending order.

reverse() None[source]

Reverse IN PLACE.

append(value: OptionalContentGroup) None[source]

Append object to the end of the list.

index(value: OptionalContentGroup, start: int = 0, stop: int | None = None) int[source]

Return first index of value.

Raises ValueError if the value is not present.