Add text watermarks

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Watermark MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-watermark -- dnx GroupDocs.Watermark.Mcp --yes
Folders, licensing and more →

On this page

One of the main features of the GroupDocs.Watermark library is adding text watermarks to documents. You may add watermarks to documents or images from local disks, as well as from streams. For a full list of supported document formats, check Supported formats.

To add a text watermark perform follow next code sample:

const groupdocs.watermark = require('@groupdocs/groupdocs.watermark')

function addATextWatermark() {
  const watermarker = new groupdocs.watermark.Watermarker("sample.docx");

  const watermark = new groupdocs.watermark.TextWatermark('top secret', new groupdocs.watermark.Font('Arial', 36));
  watermark.setForegroundColor(groupdocs.watermark.Color.getRed());
  watermark.setHorizontalAlignment(groupdocs.watermark.HorizontalAlignment.Center);
  watermark.setVerticalAlignment(groupdocs.watermark.VerticalAlignment.Center);

  watermarker.add(watermark);
  watermarker.save("sample.docx");
  watermarker.close();
}

Run the program. A new watermarked document will appear in the specified path.

What’s next

GroupDocs.Watermark offers many more capabilities for adding text watermarks. For example, it allows specifying background and foreground colors, formatting, text opacity, use of absolute or relative positioning, and so on.

On this page