TRY NEW VERSION

Try now New API BETA

Try out the new view and capabilities of the API documentation

START

SetType

SetType(sType)

Sets the type of the watermark in the document.

Parameters:

Name Type Description
sType WatermarkType

The watermark type.

Returns:

This method doesn't return any data.

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
oDocument.InsertWatermark("Watermark");
var oSettings = oDocument.GetWatermarkSettings();
oSettings.SetType("image");
oSettings.SetImageURL("https://api.onlyoffice.com/content/img/docbuilder/examples/onlyoffice_logo.png");
oSettings.SetImageSize(100 * 36000, 100 * 36000);
oDocument.SetWatermarkSettings(oSettings);
var sImage = oSettings.GetImageURL();
var oParagraph = oDocument.GetElement(0);
oParagraph.AddText("Watermark image URL: "+ sImage);
builder.SaveFile("docx", "SetType.docx");
builder.CloseFile();

Resulting document