跳到主要内容

SetImageSize

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

Syntax

expression.SetImageSize(nWidth, nHeight);

expression - A variable that represents a ApiWatermarkSettings class.

Parameters

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

Returns

boolean

Example

This example sets the parameters of the watermark settings and apply them to the document.

// How to set the image size of the watermark.

// Resize the image using the watermark settings.

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);