ImageWatermark

ImageWatermark class

Represents an image watermark.

public sealed class ImageWatermark : Watermark, IDisposable

Constructors

Name Description
ImageWatermark(Stream) Initializes a new instance of the ImageWatermark class with a specified stream.
ImageWatermark(string) Initializes a new instance of the ImageWatermark class with a specified file path.

Properties

Name Description
ConsiderParentMargins { get; set; } Gets or sets a value indicating whether the watermark size and coordinates are calculated considering parent margins.
Height { get; set; } Gets or sets the desired height of this Watermark.
HorizontalAlignment { get; set; } Gets or sets the horizontal alignment of this Watermark.
IsBackground { get; set; } Gets or sets a value indicating whether the watermark should be placed at background.
Margins { get; set; } Gets or sets the margin settings of this Watermark.
Opacity { get; set; } Gets or sets the opacity of this Watermark.
PagesSetup { get; set; } Gets or sets the pages setup settings of this Watermark.
RotateAngle { get; set; } Gets or sets the rotate angle of this Watermark in degrees.
SaveResultInMetadata { get; set; } Gets or sets a value indicating whether to save information about added watermarks in the document metadata.
ScaleFactor { get; set; } Gets or sets a value that defines how watermark size depends on parent size.
SizingType { get; set; } Gets or sets a value specifying a way watermark should be sized.
TileOptions { get; set; } Get or sets options to define repeated watermark
VerticalAlignment { get; set; } Gets or sets the vertical alignment of this Watermark.
Width { get; set; } Gets or sets the desired width of this Watermark.
X { get; set; } Gets or sets the x-coordinate of this Watermark.
Y { get; set; } Gets or sets the y-coordinate of this Watermark.

Methods

Name Description
Dispose() Disposes the current instance.

Remarks

Learn more:

Examples

Add image watermark to a document of any supported type.

foreach (string filePath in Directory.GetFiles(@"C:\Documents"))
{
    using (Watermarker watermarker = new Watermarker(filePath))
    {
        using (ImageWatermark watermark = new ImageWatermark(@"C:\watermark.png"))
        {
            watermark.HorizontalAlignment = HorizontalAlignment.Center;
            watermark.VerticalAlignment = VerticalAlignment.Center;
            watermarker.Add(watermark);
        }

        watermarker.Save();
    }
}

See Also