Add Watermark to PowerPoint C#

Watermarks are commonly used to specify the ownership or to prevent unauthorized usage of the documents. Furthermore, they are also used to display the status of a document such as manuscript, draft, etc. In this article, we’ll demonstrate how to protect PowerPoint presentations by applying watermarks programmatically. Particularly, you will learn how to add text or image watermark to PowerPoint slides using C#.

C# API to Add Watermark to PowerPoint Slides

In order to add watermarks to the PowerPoint slides, we’ll use Aspose.Slides for .NET. It is a feature-rich API that lets you create presentation documents from within the .NET applications. Furthermore, it also allows you to manipulate the existing presentation files. You can either download the API or install it using NuGet.

PM> Install-Package Aspose.Slides.NET

Add Text Watermark to PowerPoint Slides in C#

The following are the steps to add a text watermark to the PowerPoint slides using C#.

  • First, load the PowerPoint presentation using the Presentation class.
  • Get reference of the slide to which you want to add the watermark in ISlide object.
  • Calculate the position of the watermark.
  • Add a new auto shape to the Shapes collection of the slide and get its reference in IAutoShape object.
  • Add text frame to the shape and set its text using IAutoShape.AddTextFrame(string) method.
  • Set font size, color and rotation angle of the watermark.
  • Lock watermark to avoid removal or modification.
  • Finally, save the updated PowerPoint file using Presentation.Save(string, SaveFormat) method.

The following code sample shows how to add a text watermark to the PowerPoint slides.

Output

The following is the screenshot of the PowerPoint slide after adding the watermark.

Add Watermark to PowerPoint Slides in C#

Add Image Watermark to PPT Slides in C#

The following are the steps to add an image watermark to the PPT slides in C#.

The following code sample shows how to add an image watermark to PowerPoint slides.

PowerPoint Watermarking API for C# .NET - Get a Free License

You can use Aspose.Slides for .NET without evaluation limitations by requesting a temporary license.

Conclusion

In this article, you have learned how to add a watermark to the PowerPoint slides using C#. The step-by-step guide and code samples have demonstrated how to add text and image watermarks to PowerPoint presentations. In addition, you can consult the documentation to explore other features of the API. Also, you can feel free to let us know about your queries via our forum.

See Also

Info: You may want to check out Aspose.Slides free Add Watermark to PowerPoint and Remove Watermark from PowerPoint online tools.