Watermark Word Files using C# .NET

To keep your documents safe from being used in the wrong way or to put your own brand label on them, you can use watermarks. This article will show you how to easily add watermarks to your Word documents using C#. We’ll learn how to add both text watermarks and image watermarks.

Following are quick links to the covered topics:

Text & Image Watermarking - .NET API

GroupDocs.Watermark showcases .NET API for Watermarking that we will use with C# to work with watermarks in Word documents. It helps us add, remove, and take out watermarks from files like word-processing documents, presentations, spreadsheets, images, and more. You can find out more using its documentation. You can download it using NuGet.

PM> Install-Package GroupDocs.Watermark

Adding Text Watermarks to Word Documents with C#

Text watermarks are like writing on your document in a special way. You can put these on every page or just one page. Here’s how you can do it:

  • Load the Word document using Watermarker class.
  • Initialize text watermarker by using the TextWatermark class.
  • Set the appearance by adding rotation angle, alignment, opacity, foreground and background colors, etc.
  • Add your text watermark to the Word document.
  • Save your document with the new watermark using a Save method.

Here’s an example of how you can use C# to add a text watermark to a Word document:

When you follow this code, you’ll see your chosen text on every page of the Word document.

Example of Text Watermark in Word Document

Adding Image Watermarks to Word Documents with C#

Just like applying text watermarks, you can also add pictures to your Word documents. Here’s how:

  • Load your Word document file using the Watermarker class.
  • Get your logo/image ready to be attached using the ImageWatermark class.
  • Customize the watermark image by adjusting the alignment, rotation, opacity, and other options.
  • Set the page(s) you want your picture on.
  • Add your picture watermark to the loaded Word document.
  • Save your document with the picture watermark using the Save method.

This is what the code in C# looks like when you want to add an image watermark to a Word document:

If you use this code, you’ll see your chosen picture on the page you picked in your Word document.

Example of Picture Watermark in Word Document

Getting a License for Free

If you want to try this tool out without any limits, you can get a temporary license for free.

Conclusion

To finish up, now you know how to add watermarks to your Word documents using C#. We’ve learned how to add text as well as pictures as watermarks on the page(s) of Word file. If you want to know more or have questions, you can check the documentation or ask us on the forum.

See Also