WatermarkTextOptions class

WatermarkTextOptions class

Options for setting a text watermark on the converted document.

Represents configuration of the watermark appearance. The following properties can be configured:

  • text: The text to be used for the watermark.
  • font: The font name used for the watermark text.
  • color: The color of the watermark text.
  • top: The top offset of the watermark.
  • left: The left offset of the watermark.
  • width: The width of the watermark.
  • height: The height of the watermark.
  • background: Whether the watermark is rendered in the background.

The WatermarkTextOptions type exposes the following members:

Constructors

Constructor Description
init Initializes a WatermarkTextOptions instance with the specified watermark text.

Methods

Method Description
clone Clone current instance. (inherited from WatermarkOptions)
equals Determines whether two object instances are equal. (inherited from ValueObject)
equals_object (inherited from ValueObject)
equals_value_object (inherited from ValueObject)
get_hash_code Serves as the default hash function. (inherited from ValueObject)

Properties

Property Description
color The watermark font color if a text watermark is applied.
text The watermark text.
watermark_font The watermark font used when a text watermark is applied.
auto_align The watermark is automatically scaled to fit the page size when set to True. (inherited from WatermarkOptions)
background The watermark is stamped as background; if True, it is laid at the bottom, otherwise it is laid on top (default is False). (inherited from WatermarkOptions)
height The watermark height. (inherited from WatermarkOptions)
left The watermark left position. (inherited from WatermarkOptions)
rotation_angle The watermark rotation angle. (inherited from WatermarkOptions)
top The watermark top position. (inherited from WatermarkOptions)
transparency The watermark transparency. Value between 0 and 1. Value 0 is fully visible, value 1 is invisible. (inherited from WatermarkOptions)
width The watermark width. (inherited from WatermarkOptions)

Example

from groupdocs.pydrawing import Color
from groupdocs.conversion import Converter
from groupdocs.conversion.options.convert import PdfConvertOptions, WatermarkTextOptions

with Converter("./professional-services.docx") as converter:
    watermark = WatermarkTextOptions("DRAFT")
    watermark.color = Color.from_argb(128, 211, 211, 211)  # lite gray
    watermark.top = 10
    watermark.left = 10
    watermark.width = 300
    watermark.height = 300
    watermark.background = True

    options = PdfConvertOptions()
    options.pages_count = 1
    options.watermark = watermark

    converter.convert("./professional-services.pdf", options)

Guides

Task guides that use WatermarkTextOptions:

See Also