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 →

You can search a document for existing watermarks and remove them. The example below finds a “CONFIDENTIAL” text watermark and removes it, producing a clean document.

Remove text watermarks

Iterate the search results in reverse so removing an item does not shift the indexes still to visit, and call remove() for each match.

from groupdocs.watermark import Watermarker
from groupdocs.watermark.search.search_criteria import TextSearchCriteria

def clear_watermark():
    with Watermarker("./watermarked-document.pdf") as watermarker:
        possible = watermarker.search(TextSearchCriteria("CONFIDENTIAL"))
        # Remove in reverse so indexes stay valid as items are deleted
        for i in range(len(possible) - 1, -1, -1):
            watermarker.remove(possible[i])
        watermarker.save("./output.pdf")

if __name__ == "__main__":
    clear_watermark()

watermarked-document.pdf is the sample file used in this example. Click here to download it.

Binary file (PDF, 360 KB)

Download full output

Note
Use case: Remove outdated labels such as “Draft” or “Internal Use Only” before sharing a document externally.

Remove image watermarks

Image watermarks can be found with perceptual hashing and removed the same way:

from groupdocs.watermark import Watermarker
from groupdocs.watermark.search.search_criteria import ImageDctHashSearchCriteria

def clear_image_watermark():
    with Watermarker("./watermarked-document.docx") as watermarker:
        criteria = ImageDctHashSearchCriteria("./logo.png")
        criteria.max_difference = 0.9
        possible = watermarker.search(criteria)
        # Remove in reverse so indexes stay valid as items are deleted
        for i in range(len(possible) - 1, -1, -1):
            watermarker.remove(possible[i])
        watermarker.save("./output.docx")

if __name__ == "__main__":
    clear_image_watermark()

watermarked-document.docx and logo.png are the sample files used in this example. Download watermarked-document.docx and logo.png.

Binary file (DOCX, 13 KB)

Download full output