pdftools_toolbox.pdf.content.group

Classes

Group(handle)

class pdftools_toolbox.pdf.content.group.Group(handle)[source]

Bases: _NativeObject

static create(target_document: Document, size: Size) Group[source]

Create an empty group object.

The returned group object is not yet used on any page, but it is associated with the given target document.

Parameters:
Returns:

the newly created group object

Return type:

pdftools_toolbox.pdf.content.group.Group

Raises:
  • ValueError – if the targetDocument argument has already been closed

  • ValueError – if the targetDocument argument is read-only

static copy_from_page(target_document: Document, page: Page, options: PageCopyOptions | None) Group[source]

Create a group object from a page.

From a given page in an input document, create a group object in the given target document. The returned object is associated with the target document but not yet part of it.

A group that contains interactive elements can be painted once only. Interactive elements are annotations, group fields, outlines or logical structure information. If a group needs to be painted multiple times, interactive elements can be flattened or the group can be copied multiple times from the page.

There are some interactive elements such as form fields or text annotations that cannot be rotated. So if you plan to rotate the group, it is recommended to flatten form fields and annotations.

Parameters:
Returns:

the copied group, associated with the current document.

Return type:

pdftools_toolbox.pdf.content.group.Group

Raises:
property size: Size

The size of the group.

Returns:

pdftools_toolbox.geometry.real.size.Size

Raises:

StateError – if the group has already been closed

property content: Content

the group content.

If the group is writable, the content object can be used to apply new content on the group.

Returns:

pdftools_toolbox.pdf.content.content.Content

Raises:

StateError – if the group has already been closed

property isolated: bool

the transparency isolation behavior

Returns:

bool

Raises:

StateError – if the group has already been closed

property knockout: bool

the transparency knockout behavior

Returns:

bool

Raises:

StateError – if the group has already been closed