Clear 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 →

Removing existing watermarks is another powerful feature of the GroupDocs.Watermark library. It allows searching and then removing text or image watermarks from a wide range of supported documents. Removing watermarks is possible for some of the supported formats. To learn whether it is available for your format, check Supported formats.

Note
Updating of watermarks is not allowed in evaluation mode. Please set up a license as described in Licensing and evaluation.

Deleting text watermarks

To search and remove text watermarks follow next sample:

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

function removeTextWatermarks() {
    // Create an instance of Watermarker
    const watermarker = new groupdocsWatermark.Watermarker('sample.pdf');

    // Create a TextSearchCriteria instance
    const criteria = new groupdocsWatermark.TextSearchCriteria('test', false);
    const watermarks = watermarker.search(criteria);

    // Remove found text fragments
    watermarks.clear();

    // Save changes
    watermarker.save('result.pdf');

    // Close watermarker
    watermarker.close();
}

Deleting image watermarks

To search and remove image watermarks within the document:

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

function removeImageWatermarks() {
  // Create watermarker
  const watermarker = new groupdocsWatermark.Watermarker('sample.docx');

  // Initialize search criteria with the image
  const imageSearchCriteria = new groupdocsWatermark.ImageDctHashSearchCriteria("logo.png");

  // Set maximum allowed difference between images
  imageSearchCriteria.setMaxDifference(0.9);

  // Search for possible watermarks matching the criteria
  const watermarks = watermarker.search(imageSearchCriteria);

  console.log(`Found ${watermarks.getCount()} possible watermark(s).`);

    // Remove found text fragments
    watermarks.clear();

    // Save changes
    watermarker.save('result.docx');

    // Close watermarker
    watermarker.close();
}

Run the program. All found occurrences of image watermarks will be deleted.