Result of added 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 →

Watermarker.add() returns an AddWatermarkResult describing what was added. It exposes number_applied_watermarks and a succeeded collection; each succeeded item carries a unique identifier (watermark_id), the watermark_type, the page_number, the watermark_position, and the placed geometry (left, top, width, height). This enables tracing, searching, and removing specific watermarks later.

Review the result of added watermarks

The example below adds a text watermark to a two-page PDF and prints the result for each applied watermark.

from groupdocs.watermark import Watermarker
from groupdocs.watermark.watermarks import TextWatermark, Font
from groupdocs.watermark.common import HorizontalAlignment, VerticalAlignment

def get_add_result():
    with Watermarker("./sample.pdf") as watermarker:
        watermark = TextWatermark("Test watermark", Font("Arial", 19.0))
        watermark.horizontal_alignment = HorizontalAlignment.CENTER
        watermark.vertical_alignment = VerticalAlignment.CENTER

        result = watermarker.add(watermark)
        print("Applied watermarks:", result.number_applied_watermarks)
        for item in result.succeeded:
            print(f"- id={item.watermark_id} type={item.watermark_type} "
                  f"page={item.page_number} position={item.watermark_position}")

if __name__ == "__main__":
    get_add_result()

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

Applied watermarks: 2
- id=b0654d15-d1f7-407c-8568-333b52a45b43 type=0 page=1 position=1
- id=e270b100-cb84-4acd-9820-e0a6740f373c type=0 page=2 position=1

Download full output

The watermark was added to both pages, so succeeded contains two items, each with its own watermark_id. The watermark_type and watermark_position are enum values (here type=0 corresponds to a text watermark). The watermark_id GUIDs let you locate and remove these exact watermarks in a later session.