pdftools_toolbox.pdf.annotations.text_stamp

Classes

TextStamp(handle)

A text stamp annotation

class pdftools_toolbox.pdf.annotations.text_stamp.TextStamp(handle)[source]

Bases: Stamp

A text stamp annotation

static create_raw(target_document: Document, top_left: Point, height: float | None, text_type: TextStampType, text: str) TextStamp[source]

Create a text stamp annotation.

The width of the annotation is computed from the given stamp text. The returned text stamp annotation is not yet part of any page. It can be added to a page’s list of annotations.

Deprecated:

Deprecated in Version 1.0. Use static method TextStamp.Create instead.

Parameters:
Returns:

The newly created text stamp annotation.

Return type:

pdftools_toolbox.pdf.annotations.text_stamp.TextStamp

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

  • ValueError – if the targetDocument is read-only

  • ValueError – if the textType argument is pdftools_toolbox.pdf.annotations.text_stamp_type.TextStampType.CUSTOMSTAMPTEXT

  • ValueError – if the text argument is empty

static create(target_document: Document, top_left: Point, height: float | None, text_type: TextStampType) TextStamp[source]

Create a text stamp annotation.

The width of the annotation is computed based on the given textType. The returned text stamp annotation is not yet part of any page. It can be added to a page’s list of annotations.

Parameters:
Returns:

The newly created text stamp annotation.

Return type:

pdftools_toolbox.pdf.annotations.text_stamp.TextStamp

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

  • ValueError – if the targetDocument is read-only

  • ValueError – if the textType argument is pdftools_toolbox.pdf.annotations.text_stamp_type.TextStampType.CUSTOMSTAMPTEXT

property text_type: TextStampType

The displayed text

This defines a predefined text for this text stamp.

Returns:

pdftools_toolbox.pdf.annotations.text_stamp_type.TextStampType

Raises:

StateError – if the object has already been closed