Add watermarks with GroupDocs.Watermark
Leave feedback
On this page
GroupDocs.Watermark stamps text or images onto documents — Word, PDF, spreadsheets, presentations, images and more — and can find and remove watermarks that are already there.
A TextWatermark takes the text and a font. Everything else — rotation, opacity, colour, alignment — is a property you set before adding it.
using GroupDocs.Watermark;
using GroupDocs.Watermark.Common;
using GroupDocs.Watermark.Watermarks;
using (Watermarker watermarker = new Watermarker("contract.docx"))
{
TextWatermark watermark = new TextWatermark(
"CONFIDENTIAL", new Font("Arial", 42, FontStyle.Bold));
watermark.ForegroundColor = Color.Red;
watermark.Opacity = 0.4;
watermark.RotateAngle = -45;
watermark.HorizontalAlignment = HorizontalAlignment.Center;
watermark.VerticalAlignment = VerticalAlignment.Center;
watermarker.Add(watermark);
watermarker.Save("watermark-add-text.docx");
}
contract.docx is the sample file used in this example. Click here to download it.
Binary file (DOCX, 16 KB)
An ImageWatermark places a picture instead of text — a logo, a stamp, a QR code. It supports the same alignment and opacity properties.
using GroupDocs.Watermark;
using GroupDocs.Watermark.Common;
using GroupDocs.Watermark.Watermarks;
using (Watermarker watermarker = new Watermarker("contract.pdf"))
{
using (ImageWatermark watermark = new ImageWatermark("logo.png"))
{
watermark.Opacity = 0.5;
watermark.HorizontalAlignment = HorizontalAlignment.Center;
watermark.VerticalAlignment = VerticalAlignment.Center;
watermarker.Add(watermark);
}
watermarker.Save("watermark-add-image.pdf");
}
contract.pdf and logo.png are the sample files used in this example. Download contract.pdf and logo.png.
Binary file (PDF, 154 KB)
The same two calls work on any supported format. Only the file you open changes.
using GroupDocs.Watermark;
using GroupDocs.Watermark.Watermarks;
using (Watermarker watermarker = new Watermarker("rate-card.xlsx"))
{
TextWatermark watermark = new TextWatermark(
"DRAFT", new Font("Calibri", 36, FontStyle.Bold));
watermark.Opacity = 0.3;
watermark.RotateAngle = -30;
watermarker.Add(watermark);
watermarker.Save("watermark-spreadsheet.xlsx");
}
rate-card.xlsx is the sample file used in this example. Click here to download it.
Binary file (XLSX, 12 KB)
GroupDocs.Watermark also searches for existing watermarks and removes or replaces them, adds watermarks to specific pages or sections, works with the images and attachments inside a document, and applies format-specific watermarks such as PDF annotations and Word shapes.
- GroupDocs.Watermark for .NET documentation — the full product guide
- Supported file formats
- API reference
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.