Add watermarks to Diagram documents

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 →

GroupDocs.Watermark adds watermarks to Visio diagrams as shapes placed on the background or foreground of the pages. Open the diagram and pass a DiagramShapeWatermarkOptions to add() with the desired placement_type.

Note
Open Visio files with format auto-detection — Watermarker("diagram.vsdx") — rather than passing DiagramLoadOptions() to the constructor.

Add a watermark to a diagram

from groupdocs.watermark import Watermarker
from groupdocs.watermark.watermarks import TextWatermark, Font, Color
from groupdocs.watermark.common import HorizontalAlignment, VerticalAlignment
from groupdocs.watermark.options.diagram import DiagramShapeWatermarkOptions
from groupdocs.watermark.contents.diagram import DiagramWatermarkPlacementType

def add_watermark_to_diagram():
    with Watermarker("./diagram.vsdx") as watermarker:
        watermark = TextWatermark("CONFIDENTIAL", Font("Arial", 19.0))
        watermark.foreground_color = Color.red
        watermark.horizontal_alignment = HorizontalAlignment.CENTER
        watermark.vertical_alignment = VerticalAlignment.CENTER

        # Place the watermark on the background of every page
        options = DiagramShapeWatermarkOptions()
        options.placement_type = DiagramWatermarkPlacementType.BACKGROUND_PAGES
        watermarker.add(watermark, options)

        watermarker.save("./output.vsdx")

if __name__ == "__main__":
    add_watermark_to_diagram()

diagram.vsdx is the sample file used in this example. Click here to download it.

Binary file (VSDX, 11 KB)

Download full output

Use DiagramWatermarkPlacementType.FOREGROUND_PAGES to place the watermark in front of the page content instead. Watermarker.get_content() returns a DiagramContent exposing each page’s shapes and headers/footers — see Existing objects in diagrams.