__init__ constructor

On this page

init

Initializes an instance of the Watermark class.

def __init__(self, text):
    ...
Parameter Type Description
text str Watermark text.
Raises Description
ValueError If text is None or empty.

Example

from groupdocs.viewer import Viewer
from groupdocs.viewer.options import HtmlViewOptions, Watermark

with Viewer("sample.docx") as viewer:
    view_options = HtmlViewOptions.for_embedded_resources(
        "add_text_watermark/output-watermark.html"
    )
    view_options.watermark = Watermark("This is a watermark")
    viewer.view(view_options)

See Also

On this page