Adding watermark

Create a document with a watermark with custom settings:

  • create an empty page with a watermark (Api, ApiDocument/InsertWatermark);
  • edit watermark settings, set an image, specify size, direction and opacity (ApiWatermarkSettings);
const oDocument = Api.GetDocument()
oDocument.InsertWatermark("Watermark", true)
const oSettings = oDocument.GetWatermarkSettings()
oSettings.SetType("image")
oSettings.SetImageURL("https://static.onlyoffice.com/assets/docs/samples/img/onlyoffice_logo.png")
oSettings.SetImageSize(40 * 36_000, 40 * 36_000)
oSettings.SetDirection("horizontal")
oSettings.SetOpacity(100)
oDocument.SetWatermarkSettings(oSettings)

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).