__init__ constructor

On this page

init

Initializes a new instance of the TextWatermark class with a specified text and a font.

def __init__(self, text, font):
    ...
Parameter Type Description
text str The text to be used as watermark.
font Font The font of the text.

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")

See Also

On this page