pdftools_toolbox.pdf.content.group
Classes
|
- 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:
targetDocument (pdftools_toolbox.pdf.document.Document) – the output document with which the returned object is associated
size (pdftools_toolbox.geometry.real.size.Size) – the size of the group
- Returns:
the newly created group object
- Return type:
- 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:
targetDocument (pdftools_toolbox.pdf.document.Document) – the output document with which the returned object is associated
page (pdftools_toolbox.pdf.page.Page) – a page of a different document
options (Optional[pdftools_toolbox.pdf.page_copy_options.PageCopyOptions]) – the copy options
- Returns:
the copied group, associated with the current document.
- Return type:
- Raises:
OSError – Error reading from the input document or writing to the output document
pdftools_toolbox.corrupt_error.CorruptError – The input document is corrupt
pdftools_toolbox.conformance_error.ConformanceError – The conformance level of the source document is not compatible with the conformance level of the target document.
pdftools_toolbox.conformance_error.ConformanceError – The explicitly requested conformance level is PDF/A Level A (
pdftools_toolbox.pdf.conformance.Conformance.PDFA1A
,pdftools_toolbox.pdf.conformance.Conformance.PDFA2A
, orpdftools_toolbox.pdf.conformance.Conformance.PDFA3A
) and the copy optionpdftools_toolbox.pdf.page_copy_options.PageCopyOptions.copy_logical_structure
is not set.ValueError – if the targetDocument argument has already been closed
ValueError – if the targetDocument argument is read-only
ValueError – if the page object is not associated with an input document
ValueError – if the document associated with the page object has already been closed
ValueError – if the argument options has
pdftools_toolbox.pdf.page_copy_options.PageCopyOptions.form_fields
set topdftools_toolbox.pdf.forms.form_field_copy_strategy.FormFieldCopyStrategy.COPY
and the targetDocument contains form fields that have either been copied explicitly withpdftools_toolbox.pdf.forms.field_node.FieldNode.copy()
or created withpdftools_toolbox.pdf.forms.check_box.CheckBox.create()
,pdftools_toolbox.pdf.forms.combo_box.ComboBox.create()
,pdftools_toolbox.pdf.forms.comb_text_field.CombTextField.create()
,pdftools_toolbox.pdf.forms.general_text_field.GeneralTextField.create()
,pdftools_toolbox.pdf.forms.list_box.ListBox.create()
,pdftools_toolbox.pdf.forms.radio_button_group.RadioButtonGroup.create()
, orpdftools_toolbox.pdf.forms.sub_form.SubForm.create()
.ValueError – if the argument options has
pdftools_toolbox.pdf.page_copy_options.PageCopyOptions.unsigned_signatures
set topdftools_toolbox.pdf.copy_strategy.CopyStrategy.COPY
and the targetDocument contains form fields that have either been copied explicitly withpdftools_toolbox.pdf.forms.field_node.FieldNode.copy()
or created withpdftools_toolbox.pdf.forms.check_box.CheckBox.create()
,pdftools_toolbox.pdf.forms.combo_box.ComboBox.create()
,pdftools_toolbox.pdf.forms.comb_text_field.CombTextField.create()
,pdftools_toolbox.pdf.forms.general_text_field.GeneralTextField.create()
,pdftools_toolbox.pdf.forms.list_box.ListBox.create()
,pdftools_toolbox.pdf.forms.radio_button_group.RadioButtonGroup.create()
, orpdftools_toolbox.pdf.forms.sub_form.SubForm.create()
.ValueError – if options has
pdftools_toolbox.pdf.page_copy_options.PageCopyOptions.copy_outline_items
set to True and the targetDocument contains outline items that have been copied explicitly withpdftools_toolbox.pdf.navigation.outline_item.OutlineItem.copy()
.
- 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