Add watermarks to PowerPoint presentations
Leave feedback
This article describes a set of ways to add watermarks to PowerPoint presentations.
As a demonstration, feel free to add watermark for ppt with our online app, built on GroupDocs.Watermark for .NET.
Adding watermark to a particular slide
Using GroupDocs.Watermark, you can add watermark to a particular slide of a PowerPoint presentation in a simplified way. Adding watermark to a particular PowerPoint slide using GroupDocs.Watermark consists of following steps.
PresentationLoadOptionsloadOptions=newPresentationLoadOptions();// Specify an absolute or relative path to your document. Ex: @"C:\Docs\presentation.pptx"using(Watermarkerwatermarker=newWatermarker("presentation.pptx",loadOptions)){// Add text watermark to the first slideTextWatermarktextWatermark=newTextWatermark("Test watermark",newFont("Arial",8));PresentationWatermarkSlideOptionstextWatermarkOptions=newPresentationWatermarkSlideOptions();textWatermarkOptions.SlideIndex=0;watermarker.Add(textWatermark,textWatermarkOptions);// Add image watermark to the second slideusing(ImageWatermarkimageWatermark=newImageWatermark("logo.jpg")){PresentationWatermarkSlideOptionsimageWatermarkOptions=newPresentationWatermarkSlideOptions();imageWatermarkOptions.SlideIndex=1;watermarker.Add(imageWatermark,imageWatermarkOptions);}watermarker.Save("presentation.pptx");}
Protecting watermark using unreadable characters
This feature allows strengthening the protection of text watermark. Using unreadable characters in the watermark text forbids the modification using Find and Replace dialog. The following code sample shows how to include unreadable characters in watermark text using properties IsLocked and ProtectWithUnreadableCharacters of PresentationWatermarkSlideOptions.
PresentationLoadOptionsloadOptions=newPresentationLoadOptions();// Specify an absolute or relative path to your document. Ex: @"C:\Docs\presentation.pptx"using(Watermarkerwatermarker=newWatermarker("presentation.pptx",loadOptions)){TextWatermarkwatermark=newTextWatermark("Watermark text",newFont("Arial",19));PresentationWatermarkSlideOptionsoptions=newPresentationWatermarkSlideOptions();options.IsLocked=true;options.ProtectWithUnreadableCharacters=true;// Add watermarkwatermarker.Add(watermark,options);// Save documentwatermarker.Save("presentation.pptx");}
Getting slide dimensions
If for some reasons you want to use absolute sizing and positioning, you may also need to get the width and height of the slide. Use below code to get the dimensions of a particular slide.
PresentationLoadOptionsloadOptions=newPresentationLoadOptions();// Specify an absolute or relative path to your document. Ex: @"C:\Docs\presentation.pptx"using(Watermarkerwatermarker=newWatermarker("presentation.pptx",loadOptions)){PresentationContentcontent=watermarker.GetContent<PresentationContent>();Console.WriteLine(content.SlideWidth);Console.WriteLine(content.SlideHeight);}
Add watermark to all images inside a particular slide
GroupDocs.Watermark allows you to add watermark to the images inside a particular PowerPoint slide using Add method as shown in below example.
PresentationLoadOptionsloadOptions=newPresentationLoadOptions();// Specify an absolute or relative path to your document. Ex: @"C:\Docs\presentation.pptx"using(Watermarkerwatermarker=newWatermarker("presentation.pptx",loadOptions)){TextWatermarkwatermark=newTextWatermark("Protected image",newFont("Arial",8));watermark.HorizontalAlignment=HorizontalAlignment.Center;watermark.VerticalAlignment=VerticalAlignment.Center;watermark.RotateAngle=45;watermark.SizingType=SizingType.ScaleToParentDimensions;watermark.ScaleFactor=1;// Get all images from the first slidePresentationContentcontent=watermarker.GetContent<PresentationContent>();WatermarkableImageCollectionimages=content.Slides[0].FindImages();// Add watermark to all found imagesforeach(WatermarkableImageimageinimages){image.Add(watermark);}watermarker.Save("presentation.pptx");}
Working with masters, layouts, and notes
GroupDocs.Watermark enables you to access all types of the service slides in a PowerPoint presentation. Following properties of PresentationContent allows access to the corresponding slide types using the API
PresentationLoadOptionsloadOptions=newPresentationLoadOptions();// Specify an absolute or relative path to your document. Ex: @"C:\Docs\presentation.pptx"using(Watermarkerwatermarker=newWatermarker("presentation.pptx",loadOptions)){TextWatermarkwatermark=newTextWatermark("Test watermark",newFont("Arial",8));PresentationContentcontent=watermarker.GetContent<PresentationContent>();// Add watermark to all master slidesPresentationWatermarkMasterSlideOptionsmasterSlideOptions=newPresentationWatermarkMasterSlideOptions();masterSlideOptions.MasterSlideIndex=-1;watermarker.Add(watermark,masterSlideOptions);// Add watermark to all layout slidesif(content.LayoutSlides!=null){PresentationWatermarkLayoutSlideOptionslayoutSlideOptions=newPresentationWatermarkLayoutSlideOptions();layoutSlideOptions.LayoutSlideIndex=-1;watermarker.Add(watermark,masterSlideOptions);}// Add watermark to all notes slidesfor(inti=0;i<content.Slides.Count;i++){if(content.Slides[i].NotesSlide!=null){PresentationWatermarkNoteSlideOptionsnoteSlideOptions=newPresentationWatermarkNoteSlideOptions();noteSlideOptions.SlideIndex=i;watermarker.Add(watermark,noteSlideOptions);}}// Add watermark to handout masterif(content.MasterHandoutSlide!=null){PresentationWatermarkMasterHandoutSlideOptionshandoutSlideOptions=newPresentationWatermarkMasterHandoutSlideOptions();watermarker.Add(watermark,handoutSlideOptions);}// Add watermark to notes masterif(content.MasterNotesSlide!=null){PresentationWatermarkMasterNotesSlideOptionsmasterNotesSlideOptions=newPresentationWatermarkMasterNotesSlideOptions();watermarker.Add(watermark,masterNotesSlideOptions);}watermarker.Save("presentation.pptx");}
What is watermark in PowerPoint
When you’re calling Add method of Watermarker class with loaded presentation document, simple shape is added to a PowerPoint document. GroupDocs.Watermark provides some additional options when adding a shape watermark. Use PresentationWatermarkBaseSlideOptions descendant classes to set these options as shown in below example.
PresentationLoadOptionsloadOptions=newPresentationLoadOptions();// Specify an absolute or relative path to your document. Ex: @"C:\Docs\presentation.pptx"using(Watermarkerwatermarker=newWatermarker("presentation.pptx",loadOptions)){TextWatermarkwatermark=newTextWatermark("Test watermark",newFont("Arial",19));watermark.IsBackground=true;PresentationWatermarkSlideOptionsoptions=newPresentationWatermarkSlideOptions();// Set the shape nameoptions.Name="Shape 1";// Set the descriptive (alternative) text that will be associated with the shapeoptions.AlternativeText="Test watermark";// Editing of the shape in PowerPoint is forbiddenoptions.IsLocked=true;watermarker.Add(watermark,options);watermarker.Save("presentation.pptx");}
Applying text effects
You can also apply text effects when adding shape watermark to a PowerPoint slide.
PresentationLoadOptionsloadOptions=newPresentationLoadOptions();// Specify an absolute or relative path to your document. Ex: @"C:\Docs\presentation.pptx"using(Watermarkerwatermarker=newWatermarker("presentation.pptx",loadOptions)){TextWatermarkwatermark=newTextWatermark("Test watermark",newFont("Segoe UI",19));PresentationTextEffectseffects=newPresentationTextEffects();effects.LineFormat.Enabled=true;effects.LineFormat.Color=Color.Red;effects.LineFormat.DashStyle=OfficeDashStyle.DashDotDot;effects.LineFormat.LineStyle=OfficeLineStyle.Triple;effects.LineFormat.Weight=1;PresentationWatermarkSlideOptionsoptions=newPresentationWatermarkSlideOptions();options.Effects=effects;watermarker.Add(watermark,options);watermarker.Save("presentation.pptx");}
Warning
Line format settings are not supported for PPT presentations at this moment.
Applying image effects
The API also allows you to apply image effects to the shape watermark using below code.
PresentationLoadOptionsloadOptions=newPresentationLoadOptions();// Specify an absolute or relative path to your document. Ex: @"C:\Docs\presentation.pptx"using(Watermarkerwatermarker=newWatermarker("presentation.pptx",loadOptions)){using(ImageWatermarkwatermark=newImageWatermark("logo.png")){PresentationImageEffectseffects=newPresentationImageEffects();effects.Brightness=0.7;effects.Contrast=0.6;effects.ChromaKey=Color.Red;effects.BorderLineFormat.Enabled=true;effects.BorderLineFormat.Weight=1;PresentationWatermarkSlideOptionsoptions=newPresentationWatermarkSlideOptions();options.Effects=effects;watermarker.Add(watermark,options);}watermarker.Save("presentation.pptx");}