Articles in this section
Category / Section

How to add watermarks to the slides using Essential Presentation library

2 mins read

Essential Presentation does not have direct support for inserting watermarks to the slide in PowerPoint presentation and it is not feasible to directly add watermark using Microsoft PowerPoint. However, the watermark inserting can be achieved by using PictureFill and Transparency options of the Presentation library.

You can only add image through picture fill format and then apply transparency and get the watermarks in the slide. The below assemblies are needed to execute below example code,

  1. Syncfusion.Compression.Base
  2. Syncfusion.OfficeChart.Base
  3. Syncfusion.Presentation.Base

You can have two ways to insert watermarks in the slide. That’s are,

  1. Using shape with transparency:

 

You can add shape to the slide and fill color with a solid fill option. And then apply transparency for the shape. Now that shape looks like watermarks. The below code example demonstrates how to add watermarks to the slide,

//Add rectangle shape in the slide with slide boundaries.
IShape shape = slide.Shapes.AddShape(AutoShapeType.Rectangle, 0,0, slide.SlideSize.Width, slide.SlideSize.Height);
//Set fill type as solid.
shape.LineFormat.Fill.FillType = FillType.None;
//Set solid fill color as Blue.
shape.Fill.SolidFill.Color = ColorObject.White;
//Set transparency for the shape.
shape.Fill.SolidFill.Transparency = 95;
//Set rotation to the shape
shape.Rotation = -45;
//Add new paragraph to the shape.
IParagraph paragraph = shape.TextBody.AddParagraph();
//Set vertical allignment as Middle.
shape.TextBody.VerticalAlignment = VerticalAlignmentType.Middle;
//Set horizontal allignment as Center.
paragraph.HorizontalAlignment = HorizontalAlignmentType.Center;
//Add new text part to the paragraph.
ITextPart textPart = paragraph.AddTextPart();
//Text for the text part.
textPart.Text = "WaterMarks Using Shape";
//Set font size as 50.
textPart.Font.FontSize = 50;
//Set Times New Roman font style.
textPart.Font.FontName = "Times New Roman";
//Set font color for the text.
textPart.Font.Color = ColorObject.FromArgb(1000, ColorObject.LightBlue);

 

  1. Using shape with picture fill and transparency option.

 

You can add auto shape to the slide, add image in the shape using the PictureFIll option, and sets transparency for the picture fill. The below code example demonstrates how to achieve watermarks using the image and picture fill option,

//Get image instance from the file.
Image image = Image.FromFile(@"../../Data/Image10.Png");
//Add rectangle auto shape in the slide.
IShape shape2 = slide2.Shapes.AddShape(AutoShapeType.Rectangle, 0, 0, slide2.SlideSize.Width, slide2.SlideSize.Height);
//Choose picture type as picture
shape2.Fill.FillType = FillType.Picture;
//Add image for picture fill.
shape2.Fill.PictureFill.ImageBytes = image.ImageData;
//Set transparency value as 60.
shape2.Fill.PictureFill.Transparency = 60;

 

You can find the complete sample here.

Please refer here to know more about how to insert Water mark in Microsoft PowerPoint application.

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied