pdftools_toolbox.pdf.content.content_element

Classes

ContentElement(handle)

class pdftools_toolbox.pdf.content.content_element.ContentElement(handle)[source]

Bases: _NativeObject, ABC

static copy(target_document: Document, content_element: ContentElement) ContentElement[source]

Copy a content element

The returned object is associated with the given target document but not yet part of it.

Parameters:
Returns:

the copied content element, associated with the current document

Return type:

pdftools_toolbox.pdf.content.content_element.ContentElement

Raises:
  • OSError – Error reading from the source document or writing to the target document

  • 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 conformance of the targetDocument is PDF/A with a conformance level “a”: PDF/A-1a, PDF/A-2a, PDF/A-3a.

  • ValueError – if the targetDocument argument has already been closed

  • ValueError – if the targetDocument argument is read-only

  • ValueError – the contentElement object is not associated with an input document

  • ValueError – the document associated with the contentElement object has already been closed

property bounding_box: Rectangle

the bounding box

This is a rectangle that encompasses all parts of an element.

Returns:

pdftools_toolbox.geometry.real.rectangle.Rectangle

Raises:

StateError – the object has already been closed

property transform: AffineTransform

the transform to be applied to the alignment rectangle

Use this transform matrix to compute the actual location of the element’s alignment rectangle.

Returns:

pdftools_toolbox.geometry.real.affine_transform.AffineTransform

Raises:

StateError – the object has already been closed

property ocm: OptionalContentMembership

Defines the visibility of the content element depending on the optional content groups (OCGs).

Returns:

pdftools_toolbox.pdf.content.optional_content_membership.OptionalContentMembership

Raises:

StateError – the object has already been closed