TextWatermark Class
Represents a text watermark.
Inheritance Hierarchy
SystemObject
  GroupDocs.WatermarkWatermark
    GroupDocs.Watermark.WatermarksTextWatermark

Namespace: GroupDocs.Watermark.Watermarks
Assembly: GroupDocs.Watermark (in GroupDocs.Watermark.dll) Version: 20.7.0
Syntax
public class TextWatermark : Watermark

The TextWatermark type exposes the following members.

Constructors
  NameDescription
Public methodTextWatermark
Initializes a new instance of the TextWatermark class with a specified text and a font.
Properties
  NameDescription
Public propertyBackgroundColor
Gets or sets the background color of the text.
Public propertyConsiderParentMargins
Gets or sets a value indicating whether the watermark size and coordinates are calculated considering parent margins.
(Inherited from Watermark.)
Public propertyFont
Gets or sets the font of the text.
Public propertyForegroundColor
Gets or sets the foreground color of the text.
Public propertyHeight
Gets or sets the desired height of this Watermark.
(Inherited from Watermark.)
Public propertyHorizontalAlignment
Gets or sets the horizontal alignment of this Watermark.
(Inherited from Watermark.)
Public propertyIsBackground
Gets or sets a value indicating whether the watermark should be placed at background.
(Inherited from Watermark.)
Public propertyMargins
Gets or sets the margin settings of this Watermark.
(Inherited from Watermark.)
Public propertyOpacity
Gets or sets the opacity of this Watermark.
(Inherited from Watermark.)
Public propertyRotateAngle
Gets or sets the rotate angle of this Watermark in degrees.
(Inherited from Watermark.)
Public propertyScaleFactor
Gets or sets a value that defines how watermark size depends on parent size.
(Inherited from Watermark.)
Public propertySizingType
Gets or sets a value specifying a way watermark should be sized.
(Inherited from Watermark.)
Public propertyText
Gets or sets the text to be used as watermark.
Public propertyTextAlignment
Gets or sets the watermark text alignment.
Public propertyVerticalAlignment
Gets or sets the vertical alignment of this Watermark.
(Inherited from Watermark.)
Public propertyWidth
Gets or sets the desired width of this Watermark.
(Inherited from Watermark.)
Public propertyX
Gets or sets the x-coordinate of this Watermark.
(Inherited from Watermark.)
Public propertyY
Gets or sets the y-coordinate of this Watermark.
(Inherited from Watermark.)
Methods
  NameDescription
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Object.)
Remarks
Examples
Scale the text watermark depending on the parent size.
C#
foreach (string file in Directory.GetFiles("C:\\test"))
{
    using (Watermarker watermarker = new Watermarker(file))
    {
        TextWatermark watermark = new TextWatermark("test watermark", new Font("Arial", 36));
        watermark.HorizontalAlignment = HorizontalAlignment.Center;
        watermark.VerticalAlignment = VerticalAlignment.Center;
        watermark.SizingType = SizingType.ScaleToParentDimensions;
        watermark.RotateAngle = 45;
        watermark.ScaleFactor = 0.4;

        watermarker.Add(watermark);
        watermarker.Save();
    }
}
See Also