Watermark

GitHubEdit on GitHub
Plugins Info
@univerjs/watermark
Server Required
No

Watermark feature aims to provide a flexible and secure watermark solution for web pages or applications. With this feature, developers can dynamically generate text or image watermarks on the page to prevent unauthorized use or dissemination of content, and it supports various configurations.

Preset Mode

Watermark does not provide a preset, but it supports mixing with its plugins.

Installation

npm install @univerjs/watermark

Usage

import { UniverWatermarkPlugin } from '@univerjs/watermark'

import '@univerjs/watermark/facade'

import '@univerjs/watermark/lib/index.css'

const { univerAPI } = createUniver({
  // ...
  presets: [
    UniverDocsCorePreset(),
  ],
  plugins: [
    [UniverWatermarkPlugin, { 
      textWatermarkSettings: { 
        content: 'Hello, Univer!', 
        fontSize: 36, 
      }, 
    }], 
  ],
})

Plugin Mode

Installation

npm install @univerjs/watermark

Usage

import { UniverWatermarkPlugin } from '@univerjs/watermark'

import '@univerjs/watermark/facade'

import '@univerjs/watermark/lib/index.css'

const univer = new Univer({
  // ...
})

univer.registerPlugin(UniverWatermarkPlugin, { 
  textWatermarkSettings: { 
    content: 'Hello, Univer!', 
    fontSize: 36, 
  }, 
}) 

Plugins and Configuration

@univerjs/watermark

This plugin provides the core implementation of watermark functionality. It allows developers to add text or image watermarks to applications and offers various configuration options to customize the appearance and behavior of the watermark. It provides the UniverWatermarkPlugin plugin.

Reference: @univerjs/watermark

Facade API

Set Watermark

univerAPI.addWatermark('text', { content: 'hello', repeat: true })

Remove Watermark

univerAPI.removeWatermark()