pdftools_toolbox.pdf.annotations.free_text

Classes

FreeText(handle)

An annotation that displays text

class pdftools_toolbox.pdf.annotations.free_text.FreeText(handle)[source]

Bases: MarkupAnnotation

An annotation that displays text

For a free-text annotation, the annotation’s content is used as text to be displayed as the annotation’s visual manifestation on the page.

static create(target_document: Document, bounding_box: Rectangle, content: str | None, paint: Paint | None, stroke: Stroke | None = None) FreeText[source]

Create a free-text annotation.

The returned free-text annotation is not yet part of any page. It can be added to a page’s list of annotations.

Parameters:
Returns:

The newly created free text annotation.

Return type:

pdftools_toolbox.pdf.annotations.free_text.FreeText

Raises:
property font_size: float

The font size

Default value: 12.

Note: the font size has no effect when rich text is used

Returns:

float

Raises:

StateError – if the object has already been closed

property alignment: HorizontalAlignment

The text alignment

Returns:

pdftools_toolbox.geometry.horizontal_alignment.HorizontalAlignment

Raises:

StateError – if the object has already been closed

property paint: Paint

The paint for the text background and the popup

Returns:

pdftools_toolbox.pdf.content.paint.Paint

Raises: