Skip to main content

SetText

Sets the text of the watermark in the document.

Syntax

expression.SetText(sText);

expression - A variable that represents a ApiWatermarkSettings class.

Parameters

NameRequired/OptionalData typeDefaultDescription
sTextRequiredstringThe watermark text.

Returns

boolean

Example

Set the watermark text and apply styled formatting to it in a document.

// How do I assign custom text to a watermark in a document?

// Customize the watermark label with bold, italic, and colored text in a document.

let doc = Api.GetDocument();
let watermarkSettings = doc.GetWatermarkSettings();
watermarkSettings.SetType("text");
watermarkSettings.SetText("Example");
let textPr = watermarkSettings.GetTextPr();
textPr.SetFontFamily("Calibri");
textPr.SetFontSize(-1);
textPr.SetDoubleStrikeout(true);
textPr.SetItalic(true);
textPr.SetBold(true);
textPr.SetUnderline(true);
textPr.SetColor(Api.RGB(0, 255, 0));
textPr.SetHighlight("blue");
watermarkSettings.SetTextPr(textPr);
doc.SetWatermarkSettings(watermarkSettings);