pdftools_toolbox.pdf.annotations.annotation

Classes

Annotation(handle)

A page annotation

class pdftools_toolbox.pdf.annotations.annotation.Annotation(handle)[source]

Bases: _NativeObject

A page annotation

static copy(target_document: Document, annotation: Annotation) Annotation[source]

Copy an annotation

Copy an annotation object from an input document to the given targetDocument. The returned object is associated with the given target document but not yet part of it.

Parameters:
Returns:

the copied annotation, associated with the targetDocument

Return type:

pdftools_toolbox.pdf.annotations.annotation.Annotation

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

  • ValueError – if the targetDocument is read-only

  • ValueError – if the annotation is not associated with an input document

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

  • pdftools_toolbox.conformance_error.ConformanceError – The conformance level of the input document is not compatible with the conformance level of the targetDocument.

  • OSError – Error reading from the input document or writing to the output document

property bounding_box: Rectangle

The location on the page

Returns:

pdftools_toolbox.geometry.real.rectangle.Rectangle

Raises:
property hidden: bool

The annotation’s visibility

If True then the annotation is present, but is invisible and not available for user interaction. Depending on the pdftools_toolbox.pdf.annotations.annotation.Annotation.no_print property it will, however, still be visible when printing.

Returns:

bool

Raises:

StateError – if the object has already been closed

property no_print: bool

The annotation’s visibility when printing

If True then the annotation is not present in a print output of the document.

Returns:

bool

Raises:

StateError – if the object has already been closed

property no_zoom: bool

The annotation’s scaling behavior

If True then the annotation’s visual appearance does not scale with the zoom factor of a PDF viewer.

Returns:

bool

Raises:

StateError – if the object has already been closed

property no_rotate: bool

The annotation’s rotation behavior

If True then the annotation’s visual appearance does not rotate with the rotation set in a PDF viewer.

Returns:

bool

Raises:

StateError – if the object has already been closed

property id: str | None

The annotation identifier

A text string uniquely identifying it among all the annotations on its page. When creating annotations using the SDK, a unique ID is set automatically.

Returns:

Optional[str]

Raises:

StateError – if the object has already been closed