Skip to main content

SetImageSize

Sets the size (width and height) of the watermark image in the document.

Syntax​

expression.SetImageSize(nWidth, nHeight);

expression - A variable that represents an ApiWatermarkSettings class.

Parameters​

NameRequired/OptionalData typeDefaultDescription
nWidthRequiredEMUThe watermark image width.
nHeightRequiredEMUThe watermark image height.

Returns​

boolean

Example​

Control the dimensions of a watermark image in a document.

// How do I change how large the watermark image appears in a document?

// Scale the watermark image to a specific size in a document.

let doc = Api.GetDocument();
let watermarkSettings = doc.GetWatermarkSettings();
watermarkSettings.SetType("image");
watermarkSettings.SetImageURL("https://static.onlyoffice.com/assets/docs/samples/img/onlyoffice_logo.png");
watermarkSettings.SetImageSize(36000 * 70, 36000 * 80);
watermarkSettings.SetDirection("clockwise45");
watermarkSettings.SetOpacity(200);
doc.SetWatermarkSettings(watermarkSettings);