Aspose.Words Document Watermark for .NET
The Aspose.Words Document Watermark for .NET plugin provides a lightweight API for inserting and removing watermarks in documents of various formats. Use it to brand, protect, or annotate documents at scale—whether adding “Confidential” diagonals, embedding logos, or cleaning up legacy marks.
Works on Windows, Linux, and macOS with .NET Framework, .NET Core, .NET 5/6+, or Mono. No Microsoft Office required.
Installation and Setup
- Install the NuGet package
Aspose.Words
. - Apply metered licensing to unlock full capabilities ( Metered Licensing Guide ).
- For step-by-step setup, see the Installation Guide .
Supported Formats: DOC, DOCX, RTF, PDF, ODT, HTML, MHTML, EPUB, Markdown, and images.
Quick Start: Insert a Text Watermark
using Aspose.Words;
using Aspose.Words.Watermarking;
using System.Drawing;
var doc = new Document("Document.docx");
var options = new TextWatermarkOptions
{
Color = Color.Gray,
FontFamily = "Arial",
FontSize = 48,
Layout = WatermarkLayout.Diagonal,
IsSemitransparent = true
};
doc.Watermark.SetText("CONFIDENTIAL", options);
doc.Save("Document.WithWatermark.docx");
Features and Functionalities
Insert Watermarks
- Text or Image: apply textual watermarks or logos/stamps.
- Positioning: centered, tiled, or custom coordinates.
- Rotation & Transparency: set diagonal marks with adjustable opacity.
- Layering: control Z-order (behind or in front of content).
Remove Watermarks
- Delete watermarks selectively (by type or identifier).
- Strip all watermarks at once while preserving unrelated shapes.
- Safely handle headers, footers, and watermark shapes.
Customization Options
- Reusable templates (store JSON/XML configs for branding).
- Apply conditionally (e.g., based on metadata).
- Full Unicode & RTL script support for global text marks.
Performance & Scalability
- Streamed application for low memory usage.
- Batch insert/remove across files with cancellation tokens.
- Thread-safe as long as each thread manages its own
Document
.
Example: Image Watermark
var doc = new Document("Report.docx");
var options = new ImageWatermarkOptions
{
Scale = 2.0, // relative scaling
IsWashout = true
};
doc.Watermark.SetImage("logo.png", options);
doc.Save("Report.LogoWatermark.pdf");
Best Practices
- Centralize templates for consistent branding across documents.
- Check for existing watermarks before applying new ones to avoid duplication.
- Apply watermarks after cryptographic operations (signing/encryption).
- Use batch pipelines for high-volume operations; dispose
Document
instances promptly. - Monitor metered usage to optimize licensing consumption.
FAQ
Can I apply both text and image watermarks together? Yes. Multiple watermarks can be layered in one document.
Will watermarks survive format conversion? Yes. The rendering engine ensures consistent appearance across formats.
Can I remove only specific watermarks? Yes. Filter by type, shape, or identifier.
Is transparency supported?
Yes. Use IsSemitransparent
for text or IsWashout
for images.
Does this require Office installed? No. Aspose.Words is a standalone library.