This repository demonstrates practical implementations of GroupDocs.Watermark for .NET, a tool for protecting Microsoft Word documents using various watermarking techniques.
The examples show how to: - Add simple and tiled text watermarks
- Lock headers and specific document sections with passwords
- Use editable content ranges to balance protection and usability
- Combine Word editing restrictions with GroupDocs.Watermark APIs
These implementations are designed for developers who want to move beyond Microsoft Word's basic watermark feature and use professional .NET routines for document protection.
GroupDocs.Watermark for .NET is a powerful document watermarking API that allows developers to protect, brand, and secure Word, PDF, Excel, PowerPoint, and over 40 other file formats programmatically.
Key capabilities: - Add, search, and remove watermarks of any type
- Lock watermarks with password protection
- Protect against unauthorized removal
- Automate watermarking for large-scale document processing
- Works without Microsoft Office --- pure .NET implementation
It's ideal for legal contracts, confidential reports, and branded client documents.
To protect Word documents effectively, you can use one or more of the following methods:
- Header watermark -- Simple watermark added to the document header. Easy to implement, but can be manually removed.
- Tiled watermark -- Multiple repeated text instances across the page, making removal tedious.
- Password-protected section -- Watermark placed in a locked section, editable only with a password.
- Locked header + editable ranges -- Header area (with watermark) locked for editing, while selected body areas remain editable.
- Full document restriction -- Document locked using WordProcessingLockType with read-only or form-field access.
These methods are fully demonstrated in the included code examples. Each approach builds upon the previous one, offering increasing levels of security.
Protect-Word-Documents-using-GroupDocs.Watermark-for-.NET/
β
βββ GroupDocs.Watermark-for-.NET-Word-Protection-Sample.csproj # .NET 6 project file
βββ Program.cs # Entry point: runs protection routines
β βββ AddSimpleHeaderWatermark # Basic watermark in header
β βββ AddTiledWatermark # Repeated tiled watermark
β βββ AddTiledImageWatermark # Repeated tiled image watermark
β βββ AddLockedSectionWatermark # Password-protected hidden section
β βββ AddLockedHeaderWatermark # Locked header + editable content
βββ Resources/ # Input/output test files
| (create this folder where you need)
βββ README.md # This documentation
Protection Level: Medium-High | Difficulty: Easy | Best for: Brand protection, copyright claims, and professional documents
Image watermarks take protection to the next level by using your company logo, signature, or custom graphics instead of plain text. When tiled across the document, they create a professional security layer that's harder to replicate or forge than simple text watermarks.
private static void AddTiledImageWatermark(string imageWatermarkFilePath)
{
using (Watermarker watermarker = new Watermarker(InputFile))
{
// Create the image watermark object
var watermark = new ImageWatermark(imageWatermarkFilePath);
// Configure tile options
watermark.TileOptions = new TileOptions()
{
LineSpacing = new MeasureValue()
{
MeasureType = TileMeasureType.Percent,
Value = 10
},
WatermarkSpacing = new MeasureValue()
{
MeasureType = TileMeasureType.Percent,
Value = 8
},
};
// Set watermark properties
watermark.Opacity = 0.7;
watermark.RotateAngle = -30;
// Add watermark
watermarker.Add(watermark);
watermarker.Save(Path.Combine(OutputDir, "image_tiled_watermark.docx"));
}
} See the professional image watermark in action:
Protection Level: Very High | Difficulty: Medium | Best for: Documents requiring both security and user interaction
This sophisticated approach combines locked headers with Microsoft Word's editable ranges feature. The watermark sits in a password-protected header that's completely locked, while specific document areas remain editable for legitimate users.
How it works: The entire header section (containing your watermark) is locked with read-only protection. The document body is then marked with editable ranges, creating a security model where users can only modify pre-approved sections.
private static void AddLockedHeaderWatermark()
{
Console.WriteLine("Adding locked header watermark...");
var loadOptions = new WordProcessingLoadOptions();
using (var watermarker = new Watermarker(InputFile, loadOptions))
{
var watermark = new TextWatermark("GroupDocs Watermark", new Font("Arial", 19))
{
VerticalAlignment = VerticalAlignment.Center,
HorizontalAlignment = HorizontalAlignment.Center,
RotateAngle = 25,
Opacity = 0.8
};
var options = new WordProcessingWatermarkSectionOptions
{
SectionIndex = 0,
IsLocked = true,
Password = "012345",
LockType = WordProcessingLockType.ReadOnly
};
watermarker.Add(watermark, options);
watermarker.Save(Path.Combine(OutputDir, "locked_header_watermark.docx"));
}
Console.WriteLine("Locked header watermark added.");
}Watch the locked header protection:
If youβre working with document protection or watermarking, the following articles may be helpful:
-
5 Secure Methods to Add Watermarks to Word Documents β Discover different ways to apply watermarks safely and effectively using GroupDocs.Watermark: Read the article β
-
AI-Powered Watermarking: Protect Documents with Smart, Context-Aware Marking β Learn how to integrate GroupDocs.Watermark into your AI agent to generate intelligent, adaptive watermarks: Read the article β
-
Python Tiling Watermark Examples: How to Create Repeated Watermarks in Documents β Explore how to apply various tiling watermark patterns using GroupDocs.Watermark for Python: Read the article β
π¬ This repository is part of GroupDocs educational samples. All names and data are automatically generated for demonstration purposes only.
add watermark to Word Β· Word document security Β· protect Word documents Β· C# watermark code Β· .NET watermark library Β· remove watermark protection Β· locked watermarks Β· password-protected watermarks Β· document protection API Β· GroupDocs.Watermark examples Β· tiled watermarks Β· secure Word documents Β· watermark removal prevention Β· Word DOCX watermark Β· enterprise document security Β· watermark automation Β· programmatic watermarking Β· image watermark Word Β· logo watermark documents Β· watermark API .NET Β· prevent watermark deletion Β· Word document locking Β· confidential document watermark Β· legal document protection Β· batch watermark documents Β· DOCX protection methods

