TextWatermark

TextWatermark class

Represents a text watermark.

public class TextWatermark : Watermark

Constructors

Name Description
TextWatermark(string, Font) Initializes a new instance of the TextWatermark class with a specified text and a font.

Properties

Name Description
BackgroundColor { get; set; } Gets or sets the background color of the text.
ConsiderParentMargins { get; set; } Gets or sets a value indicating whether the watermark size and coordinates are calculated considering parent margins.
Font { get; set; } Gets or sets the font of the text.
ForegroundColor { get; set; } Gets or sets the foreground color of the text.
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.
Padding { get; set; } Gets or sets the padding settings of this TextWatermark. This property is applicable only to image files.
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.
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.
Text { get; set; } Gets or sets the text to be used as watermark.
TextAlignment { get; set; } Gets or sets the watermark text alignment.
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.

Remarks

Learn more:

Examples

Scale the text watermark depending on the parent size.

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