TextWatermark class

TextWatermark class

Represents a text watermark.

Learn more:

The TextWatermark type exposes the following members:

Constructors

Constructor Description
init Initializes a new instance of the TextWatermark class with a specified text and a 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 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; otherwise, margins are ignored (default is False). (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 watermark is placed in the background when True; otherwise it appears in the foreground (top). The 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. (inherited from Watermark)
sizing_type The sizing type specifying how the watermark should be sized. (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