Skip to content

Instantly share code, notes, and snippets.

@GroupDocsGists
Last active October 27, 2025 14:26
Show Gist options
  • Save GroupDocsGists/409bb8d097cefeb3a35d8b94d49d078b to your computer and use it in GitHub Desktop.
Save GroupDocsGists/409bb8d097cefeb3a35d8b94d49d078b to your computer and use it in GitHub Desktop.

5 Secure Methods to Add Watermarks to Word Documents

Looking to protect Word documents with watermarks that can't be easily removed? This repository demonstrates how to add password-protected watermarks in C# using the GroupDocs.Watermark for .NET library. Unlike Microsoft Word's built-in watermarks (removable in 1 click), these methods provide enterprise-grade document security with locked headers, tiled patterns, and password protection.

✅ This C# example answers: How to prevent watermark removal in Word documents?

🧩 Features Demonstrated

  • Simple Header Watermarks – Basic protection for internal documents
  • Tiled Watermarks – Multiple overlapping instances for medium security
  • Image Watermarks – Brand protection with logos and company seals
  • Password-Protected Sections – High security with locked, hidden watermarks
  • Locked Headers with Editable Ranges – Maximum protection for templates and forms
  • Customize text, font, rotation angle, and opacity
  • Support for watermark automation for enterprise batch processing
  • Works with Word (DOCX), PDF, Excel, PowerPoint, and 40+ file formats

✅ Steps to Add Secure Watermarks to Word Documents

  1. Install the GroupDocs.Watermark package from NuGet
  2. Load your Word document (DOCX, DOC, DOCM)
  3. Choose your protection method (simple, tiled, password-protected, or locked)
  4. Configure watermark properties (text, image, rotation, opacity)
  5. Apply password protection and locking options
  6. Save the watermarked document with removal-resistant protection

Related Article(s):

📖 5 Secure Methods to Add Watermarks to Word Documents

📖 How to Generate Tiling Watermarks

📖 Python Tiling Watermark Examples: How to Create Repeated Watermarks in Documents

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("Company Confidential", new Font("Arial", 19))
{
VerticalAlignment = VerticalAlignment.Center,
HorizontalAlignment = HorizontalAlignment.Center,
RotateAngle = 25,
ForegroundColor = Color.Red,
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.");
}
private static void AddLockedWatermark_AllowOnlyFormFields()
{
Console.WriteLine("Adding locked watermark (allow form fields)...");
using (var watermarker = new Watermarker(InputFile))
{
var watermark = new TextWatermark("Do Not Edit", new Font("Arial", 36, FontStyle.Bold | FontStyle.Italic))
{
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Opacity = 0.4,
RotateAngle = 45,
ForegroundColor = Color.Red
};
var options = new WordProcessingWatermarkPagesOptions
{
IsLocked = true,
Password = "012345",
LockType = WordProcessingLockType.AllowOnlyFormFields
};
watermarker.Add(watermark, options);
watermarker.Save(Path.Combine(OutputDir, "locked_allow_form_fields.docx"));
}
Console.WriteLine("Locked watermark added (AllowOnlyFormFields).");
}
private static void AddSimpleHeaderWatermark()
{
Console.WriteLine("Adding simple header watermark...");
var loadOptions = new WordProcessingLoadOptions();
using (var watermarker = new Watermarker(InputFile, loadOptions))
{
var watermark = new TextWatermark("Confidential", new Font("Arial", 19))
{
VerticalAlignment = VerticalAlignment.Center,
HorizontalAlignment = HorizontalAlignment.Center,
RotateAngle = 25,
ForegroundColor = Color.Red,
Opacity = 0.8
};
watermarker.Add(watermark, options);
watermarker.Save(Path.Combine(OutputDir, "header_watermark.docx"));
}
Console.WriteLine("Header watermark added.");
}
private static void AddTiledImageWatermark()
{
using (Watermarker watermarker = new Watermarker(InputFile))
{
// Create the image watermark object
var watermark = new ImageWatermark("logo.png");
// 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(OutputDir, "image_watermark.docx");
}
}
private static void AddTiledWatermark()
{
Console.WriteLine("Adding tiled watermark...");
var loadOptions = new WordProcessingLoadOptions();
using (var watermarker = new Watermarker(InputFile, loadOptions))
{
var watermark = new TextWatermark("Protected Document", new Font("Arial", 19))
{
VerticalAlignment = VerticalAlignment.Center,
HorizontalAlignment = HorizontalAlignment.Center,
RotateAngle = 25,
ForegroundColor = Color.Red,
Opacity = 0.9,
TileOptions = new TileOptions
{
LineSpacing = new MeasureValue
{
MeasureType = TileMeasureType.Percent,
Value = 12
},
WatermarkSpacing = new MeasureValue
{
MeasureType = TileMeasureType.Percent,
Value = 12
}
}
};
var options = new WordProcessingWatermarkSectionOptions
{
Name = "TiledShape",
AlternativeText = "Repeated watermark"
};
watermarker.Add(watermark, options);
watermarker.Save(Path.Combine(OutputDir, "tiled_watermark.docx"));
}
Console.WriteLine("Tiled watermark added.");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment