TextWatermark Class
Represents the text watermark that appears behind the document content.
- Inheritance:
- System.ObjectTextWatermark
Constructors
TextWatermark(DocumentModel, String)
Initializes a new instance of the text watermark with the default width and height.
public TextWatermark(DocumentModel document, string text)
Public Sub New(document As DocumentModel, text As String)
Parameters
document
- DocumentModel
The owner document.
text
- System.String
The text of the watermark.
TextWatermark(DocumentModel, String, Double, Double)
Initializes a new instance of the text watermark with the given width and height.
public TextWatermark(DocumentModel document, string text, double width, double height)
Public Sub New(document As DocumentModel, text As String, width As Double, height As Double)
Parameters
document
- DocumentModel
The owner document.
text
- System.String
The text of the watermark.
width
- System.Double
The width of the watermark (in points).
height
- System.Double
The height of the watermark (in points).
TextWatermark(DocumentModel, String, Double, Double, LengthUnit)
Initializes a new instance of the text watermark with the given width and height.
public TextWatermark(DocumentModel document, string text, double width, double height, LengthUnit lengthUnit)
Public Sub New(document As DocumentModel, text As String, width As Double, height As Double, lengthUnit As LengthUnit)
Parameters
document
- DocumentModel
The owner document.
text
- System.String
The text of the watermark.
width
- System.Double
The width of the watermark.
height
- System.Double
The height of the watermark.
lengthUnit
- LengthUnit
The used length unit.
Properties
Color
Gets or sets the font color used for the watermark.
Property Value
The font color used for the watermark.
Remarks
Changing the font color also changes the transparency of the text which can affect the Semitransparent property.
FontName
Gets or sets the font name used for the watermark.
Property Value
- System.String
The font name used for the watermark.
Semitransparent
Gets or sets whether the text of the watermark will be semitransparent. The default value is true.
Property Value
- System.Boolean
True if the text of the watermark should be semitransparent, false otherwise.
Size
Gets or sets the size of the watermark shape. To set the size as default, use empty size.
Property Value
The size of the watermark shape.
Remarks
The height of the TextWatermark is ignored when saving to PDF, XPS, and image formats. This is because GemBox.Document currently doesn't support scaling of characters in these formats which is necessary to support height independently of width. Currently the width is used and height is calculated to naturally fit the chosen font.
Text
Gets or sets the text of the watermark.
Property Value
- System.String
The text of the watermark.
TextBox
Gets the underlying TextBox that represents the watermark.
Property Value
The TextBox that represents the watermark.
Methods
SetDiagonal()
Sets the text of the watermark as diagonal (rotated).
SetHorizontal()
Sets the text of the watermark as horizontal.