TextWatermark class

TextWatermark class

Represents a text watermark.

Learn more:

The TextWatermark type exposes the following members:

Constructors

Constructor Description
init Initializes a new TextWatermark with the specified text and font.

Properties

Property Description
background_color The background color of the text.
font The font of the text.
foreground_color The foreground color of the text.
padding The padding settings of this TextWatermark, applicable only to image files.
text The text to be used as watermark.
text_alignment The watermark text alignment.
consider_parent_margins The property indicating whether the watermark size and coordinates are calculated considering parent margins. If set to True, calculations consider parent margins; by default the value is False and parent margins are ignored. (inherited from Watermark)
height The desired height of this Watermark. (inherited from Watermark)
horizontal_alignment The horizontal alignment of this Watermark. (inherited from Watermark)
is_background The property indicating whether the watermark should be placed in the background. If true, the watermark is placed at the bottom; otherwise, it is placed at the top (default is False). (inherited from Watermark)
margins The margin settings of this Watermark. (inherited from Watermark)
opacity The opacity of this Watermark. (inherited from Watermark)
pages_setup The pages setup settings of this Watermark. (inherited from Watermark)
rotate_angle The rotate angle of this Watermark in degrees. (inherited from Watermark)
save_result_in_metadata The property indicates whether to save information about added watermarks in the document metadata. (inherited from Watermark)
scale_factor The scale factor of this Watermark, defining how watermark size depends on parent size. (inherited from Watermark)
sizing_type The sizing type of the watermark. (inherited from Watermark)
tile_options The options to define a repeated watermark. (inherited from Watermark)
vertical_alignment The vertical alignment of this Watermark. (inherited from Watermark)
width The desired width of this Watermark. (inherited from Watermark)
x The x-coordinate of this Watermark. (inherited from Watermark)
y The y-coordinate of this Watermark. (inherited from Watermark)

Example

from groupdocs.watermark import Watermarker
from groupdocs.watermark.watermarks import TextWatermark, Font, Color

with Watermarker("document.pdf") as watermarker:
    watermark = TextWatermark("CONFIDENTIAL", Font("Arial", 48))
    watermark.foreground_color = Color.red
    watermark.opacity = 0.5
    watermarker.add(watermark)
    watermarker.save("watermarked.pdf")

Guides

Task guides that use TextWatermark:

See Also