pdftools_toolbox.pdf.content.optional_content_membership

Classes

OptionalContentMembership(handle)

class pdftools_toolbox.pdf.content.optional_content_membership.OptionalContentMembership(handle)[source]

Bases: _NativeObject

depends_on(ocg: OptionalContentGroup) bool[source]

Checks if the content element depends on a given pdftools_toolbox.pdf.optional_content_group.OptionalContentGroup .

Parameters:

ocg (pdftools_toolbox.pdf.optional_content_group.OptionalContentGroup) – The optional content group to be checked.

Return type:

bool

property is_visible: bool

The element visibility.

True if the element is visible in the default configuration or pdftools_toolbox.pdf.document.Document.optional_content_groups is empty. False, otherwise.

Returns:

bool

Raises:

StateError – the object has already been closed

property expression: str | None

The content element visibility function.

Optional content membership expression defines the visibility as a boolean function of OCG indices in C syntax. The OCG index represents the position of the element in the OCG list which can be retrieved by using pdftools_toolbox.pdf.document.Document.optional_content_groups . Example: “1 || 2” means that the content element is visible if either OCG 1 or OCG 2 is ON.

Alternatively, the evaluated expression can be fetched via pdftools_toolbox.pdf.content.optional_content_membership.OptionalContentMembership.is_visible .

Returns:

Optional[str]

Raises:

StateError – the object has already been closed