Watermark class

Watermark class

Represents a text watermark.

See the online documentation for more information.

The Watermark type exposes the following members:

Constructors

Constructor Description
init Initializes an instance of the Watermark class.

Properties

Property Description
color The watermark color. Default value is Rgb24Color.known_colors.css_level1.red.
font_name The font name used for the watermark.
position The watermark position. Default value is Position.diagonal.
size The watermark size. Default value is Size.full_size.
text The watermark text.

Example

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

def add_text_watermark():
    # Load document
    with Viewer("sample.docx") as viewer:
        # Create an HTML file.
        viewOptions = HtmlViewOptions.for_embedded_resources(
            "add_text_watermark/output-watermark.html"
        )
        # Add watermark.
        viewOptions.watermark = Watermark("This is a watermark")
        viewer.view(viewOptions)

if __name__ == "__main__":
    add_text_watermark()

Guides

Task guides that use Watermark:

See Also