How To Add Watermark to Presentation Slides

Posted by in C# category on for Beginner level | Points: 250 | Views : 3919 red flag

This article will demonstrate how to add image watermark or text watermark into one or all of the PowerPoint presentation slides using free Spire.Presentation.


There are different concepts for what Watermark is, but usually when we need to add watermark to our documents is either to discourage others from unauthorized copying or to add a background to the document to display a confidential or draft status or whatever other status. Then, how to add a watermark into PowerPoint presentation programmatically? It can be added in various ways, but one of the best should probably be Spire.Presentation.

This article will demonstrate how to add image watermark or text watermark into one or all of the PowerPoint presentation slides using free Spire.Presentation

Using the code

Part 1. Add Image Watermark

Create an instance of Presentation class and load a existing ppt document.

Presentation ppt = new Presentation();


Then, get the reference of a slide by using its Index and Set the Slide Background Type of the Slide to custom, here we have to set it as custom, otherwise the image won’t be rendered.

ppt.Slides[0].SlideBackground.Type = Spire.Presentation.Drawing.BackgroundType.Custom;

Next, set the FillType of the Slide Background to Picture and set the FillType of Picture using PictureFillType enum, Here we set the picture filltype as stretch as below.

ppt.Slides[0].SlideBackground.Fill.FillType = FillFormatType.Picture;

ppt.Slides[0].SlideBackground.Fill.PictureFill.FillType = PictureFillType.Stretch;

Then, instantiate Image object with an image that can be used for the Slide Background using PictureFill.Picture.EmbedImage.

IImageData image =ppt.Images.Append(Image.FromFile("WaterMark.png"));

ppt.Slides[0].SlideBackground.Fill.PictureFill.Picture.EmbedImage = image;

Last, save it and we will see the effect as below.

ppt.SaveToFile(resultFileName, Spire.Presentation.FileFormat.PPT);

Part 2. Add Text Watermark

In Spire.Presentation the text watermark is based on shape, and it uses the locking property of shape to protect the shape from selection and edition. Let’s take an example.

The first step is same as image watermark creation, which is to create an instance of Presentation class and load a ppt document. And then create a shape and apply its formatting, here the important point is that the SelectionProtection property of the shape must be set to true.

Presentation ppt = new Presentation();


RectangleF rect = new RectangleF(82,195,555,149);

IAutoShape shape = ppt.Slides[0].Shapes.AppendShape(Spire.Presentation.ShapeType.Rectangle, rect);

shape.Fill.FillType = FillFormatType.None;

shape.Line.FillType = FillFormatType.None;

shape.Rotation = -45;

shape.Locking.SelectionProtection = true;

Next, apply formatting to the text with TextFrame property of the shape. Note that there is no direct property for setting the transparency of the text color, but there is alpha value associated with the color that can be used for setting the transparency. Its value ranges from 0 to 255. 0 means total transparency and 255 means no transparency.

shape.TextFrame.Text = "Confidential";

shape.TextFrame.TextRange.FontHeight = 90;

shape.TextFrame.TextRange.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;

shape.TextFrame.TextRange.Fill.SolidColor.Color = Color.FromArgb(70, Color.Black);

At last, save and we see the result as below.

ppt.SaveToFile(resultFileName, Spire.Presentation.FileFormat.PPT);


Spire.Presentation is a professional PowerPoint® compatible component that enables developers to create, read, write, modify, convert and Print PowerPoint documents from any .NET platform. As an independent PowerPoint .NET component, Spire.Presentation for .NET doesn't need Microsoft PowerPoint installed on the machine.

Page copy protected against web site content infringement by Copyscape

About the Author

Full Name: Oliver D
Member Level: Starter
Member Status: Member
Member Since: 4/3/2014 3:26:03 AM
Country: United States

Login to vote for this post.

Comments or Responses

Login to post response

Comment using Facebook(Author doesn't get notification)