Watermarks are normally used to protect the documents from any unauthorized use. To protect your presentations and to claim ownership, today we will learn how to programmatically add text and image watermarks to the Microsoft PowerPoint presentations within .NET applications using C#. In a separate article, we have seen applying watermarks to images in C#.
Let’s quickly move to separately learn, how we can apply text and image-based watermarks to the whole presentation or specific slide using the watermarking API for .NET applications.
Watermarking API for .NET
GroupDocs.Watermark for .NET is a watermarking API that allows adding text and image watermarks to the presentations and many other documents of different file formats within .NET applications. It provides watermarking methods that add watermarks that are hard to get automatically removed by other tools.
Along with the presentations, the API supports adding, removing, and extracting watermarks from word-processing documents, spreadsheets, email messages, PDF files, images, Visio drawings, and many other formats. Among presentation file formats, it supports PPT, PPTX, PPS, PPTM, PPSX, and others. From the documentation, you may further check the features and supported file formats.
You can download the DLLs or MSI installer from the downloads section or get it from NuGet.
Install-Package GroupDocs.Watermark
Add Text to Slides as Watermark using C#
The API provides customizations to add text to presentations as watermark. The following steps guide you how to apply watermark on presentation files within .NET application.
- Load the presentation using Watermarker.
- Set watermark text and style using TextWatermark.
- Set other properties like rotation, size, opacity, color, and position.
- Provide the index of the slide to apply the watermark.
- Add the formatted text watermark using Add method.
- Save the watermarked presentation using the Save method.
The following code sample adds a text label to the PPTX presentation as a watermark on the first slide with rotation using C#.
If you do not provide a slide index, the watermark will be added on all the slides by default. The above code shows how to mention the slide index, however, I have shown you the output with a text watermark on all the slides of the PPTX presentation.
Insert Image Watermark to Slides using C#
Likewise, you can add images on presentation files as watermark. You just have to use the ImageWatermark class instead of the TextWatermark. The following are the steps to add image watermark to presentation slides within your .NET applications.
- Load the presentation using Watermarker.
- Load the image file that will be used as a watermark using ImageWatermark.
- Set image watermark properties like rotation, size, opacity, color, and position.
- Set the slide index on which to apply the watermark.
- Add the image watermark to the presentation using Add method.
- Save the watermarked presentation using the Save method.
The following code sample adds an image to the PPTX presentation as a watermark on the second slide using C#.
The following is the output of the above code with an image watermark only on the second slide of the PPTX presentation.
Conclusion
To sum up, you have learned how to add text and image watermarks to your presentation slides using C#. Now you can build your own .NET application that supports text as well as image watermarks for the presentation files and specific slides of the presentation. Consult the documentation to apply watermarks to various other document formats.
You can have a Free Temporary License to experience every aspect of the product. Free support will be happy to get you out of any confusion and resolve your queries related to watermarks on the forum.