How to apply water mark to only office documents using watermarkJsonData in editConfig json string

I am using the below code. In GetWatermarkJsonData() I am passing watermark details like text, fontSize…, . Do I need to add any other values or plugin to achieve this. Please guide me

var config = new Dictionary<string, object>
{
    { "type", "desktop" },
    { "documentType", await GetDocumentType() },
    { "watermarkJsonData", GetWatermarkJsonData()  },
    { "auditConfig", GetAuditConfig() },
    {
        "document", new Dictionary<string, object>
        {
            { "title", _itemContent.DisplayName },
            { "url", _presignedUrl },
            { "fileType", _itemContent.Extension },
            { "key", $"{parameters.ItemId}_{documentCreatedTicks}" },
            {
                "info", new Dictionary<string, object>
                {
                    { "owner", "Me" },
                    { "uploaded", _dateTimeProvider.UtcNow.ToShortDateString() },
                    { "favorite", null },
                }
            },
            {
                "permissions", new Dictionary<string, object>
                {
                    { "comment", false },
                    { "download", hasDownloadPermission },
                    { "print", hasPrintPermission },
                    { "edit", false },
                    { "copy", false },
                    { "fillForms", false },
                    { "modifyFilter", false },
                    { "modifyContentControl", false },
                    { "review", false },
                }
            },
        }
    }
}

Hi @ArunSterling :wave:
May I ask you a few questions to better understand your requirements?

  1. Are you using ONLYOFFICE Desktop Editors? image

  2. What version of the editor are you using?

  3. Could you describe in more detail the goal you are trying to achieve?

We have a plugin available here: ONLYOFFICE Plugin. This plugin demonstrates how to protect a document using a watermark.

Additionally, you can refer to this method for inserting watermarks: Insert Watermark API.

Hi @Nikolas , I am using oov 8.0.1 version.

var watermarkSettings = {
copyoutenabled: false,
watermark_on_draw: JSON.stringify({
“type”: “rect”,
“transparent”: watermarkConfig.opacity / 100,
“width”: 400,
“height”: 400,
“rotate”: angle,
“align”: 1,
“paragraphs”: [{
“align”: 2,
“linespacing”: 1,
“runs”: [
{
“text”: “Water mark text”,
“font-family”: “Arial”,
“font-size”: 20,
“color”: “rgba(0,255,255,0)”,
“bold”: false,
“italic”: false,
“strikeout”: false,
“underline”: false
},
{
“text”: “<%br%>”
}
]
}
]
})
};
console.log(‘Watermark settings’,watermarkSettings);
window.Asc.plugin.executeMethod(“SetProperties”, [watermarkSettings], function () {
console.log(‘Watermark SET’);
window.Asc.plugin.executeCommand(“close”, “”);
});

We are setting watermark using the above code, all the styles are set, except “color”, tried giving color directly as “blue” and “rgba” code as well. Could you please help to fix this. We need to set color using the above json format.

Hi @Jagan

Looks like you’re implementing watermark features in your document setup. It seems you are using version 8.0.1.
Can you confirm if this behavior also occurs with version 8.2.0/8.2.1?