Last active
May 1, 2021 20:35
-
-
Save GroupDocsGists/c5637a7b8dd5d881e58e502c109ca4a0 to your computer and use it in GitHub Desktop.
Apply Watermark to Presentation Slides in C# using .NET API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add image watermark to presentation slides in C# using .NET API | |
using (Watermarker watermarker = new Watermarker("presentation.pptx")) | |
{ | |
// Set watermark image, coordinates and formatting | |
ImageWatermark imageWatermark = new ImageWatermark("watermark-image.png"); | |
imageWatermark.Opacity = .7; | |
imageWatermark.X = 80; | |
imageWatermark.Y = 120; | |
// Apply Watermark to only second slide of the presentation | |
PresentationWatermarkSlideOptions ImageWatermarkOptions = new PresentationWatermarkSlideOptions(); | |
ImageWatermarkOptions.SlideIndex = 1; | |
// Add watermark to presentation and save. | |
watermarker.Add(imageWatermark, ImageWatermarkOptions); | |
watermarker.Save("image-watermarked-presentation.pptx"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add text watermark to presentation slides in C# using .NET API | |
using (Watermarker watermarker = new Watermarker("presentation.pptx")) | |
{ | |
// Set watermark text, coordinates and formatting | |
TextWatermark watermark = new TextWatermark("Watermark", new Font("Arial", 36)) | |
{ | |
RotateAngle = -45, | |
X = 100, | |
Y = 100, | |
Height = 400, | |
Width = 400, | |
Opacity = .2, | |
ForegroundColor = Color.DarkBlue, | |
HorizontalAlignment = HorizontalAlignment.Center, | |
VerticalAlignment = VerticalAlignment.Center | |
}; | |
// Apply Watermark to only first slide of the presentation | |
PresentationWatermarkSlideOptions textWatermarkOptions = new PresentationWatermarkSlideOptions(); | |
textWatermarkOptions.SlideIndex = 0; | |
// Add watermark to presentation and save. | |
watermarker.Add(watermark, textWatermarkOptions); | |
watermarker.Save("text-watermarked-presentation.pptx"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment