ImageWatermark class

ImageWatermark class

Represents an image watermark.

Learn more:

The ImageWatermark type exposes the following members:

Constructors

Constructor Description
init Initializes a new ImageWatermark instance with a specified file path.
init Initializes a new ImageWatermark instance using the provided image stream.

Methods

Method Description
dispose Disposes the current instance.

Properties

Property Description
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 ImageWatermark, SizingType

with Watermarker("document.docx") as watermarker:
    watermark = ImageWatermark("logo.png")
    watermark.sizing_type = SizingType.SCALE_TO_PARENT_DIMENSIONS
    watermark.scale_factor = 0.5
    watermark.opacity = 0.7
    watermarker.add(watermark)
    watermarker.save("watermarked.docx")

Guides

Task guides that use ImageWatermark:

See Also