pdftools_toolbox.pdf.annotations.text_stamp
Classes
|
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:
targetDocument (pdftools_toolbox.pdf.document.Document) – The output document with which the returned object is associated.
topLeft (pdftools_toolbox.geometry.real.point.Point) – The location of the annotation’s upper left corner on the page.
height (Optional[float]) – The height of the annotation.
textType (pdftools_toolbox.pdf.annotations.text_stamp_type.TextStampType) – The text stamp type.
text (str) – The text to be shown in this stamp.
- Returns:
The newly created text stamp annotation.
- Return type:
- 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:
targetDocument (pdftools_toolbox.pdf.document.Document) – The output document with which the returned object is associated.
topLeft (pdftools_toolbox.geometry.real.point.Point) – The location of the annotation’s upper left corner on the page.
height (Optional[float]) – The height of the annotation.
textType (pdftools_toolbox.pdf.annotations.text_stamp_type.TextStampType) – The text stamp type.
- Returns:
The newly created text stamp annotation.
- Return type:
- 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