using System;
using System.Drawing;
using Aspose.Slides;
using Aspose.Slides.Export;

namespace SlidesWatermark
{
    class Program
    {
        static void Main(string[] args)
        {
            string PathForWatermarkPptFile = @"Y:\Downloads\";
            License license = new License();
            license.SetLicense(PathForWatermarkImageFile + "Conholdate.Total.Product.Family.lic");

            //Load the presentation to insert watermark 
            Presentation WatermarkPptxPresentation = new Presentation(PathForWatermarkPptFile + "PictureWatermark.pptx");
       
            // Loading watermark image to add in PPTX
            System.Drawing.Image WatermarkLogo = (System.Drawing.Image)new Bitmap("Picture Watermark Logo.jpg");
            IPPImage WatermarkImage = WatermarkPptxPresentation.Images.AddImage(WatermarkLogo);

            //Accessing the master slides for adding watermark image
            foreach (IMasterSlide masterSlide in WatermarkPptxPresentation.Masters)
            {
                //Adding a Ppt watermark shape for logo image
                IPictureFrame PptxWatermark = masterSlide.Shapes.AddPictureFrame(ShapeType.Rectangle,0, 0,
                    200, 50, WatermarkImage);

                //Set the rotation angle of the shape
                PptxWatermark.Rotation = 325;

                //Lock Pptx watermark image shape for protection in PowerPoint 
                PptxWatermark.ShapeLock.SizeLocked = true;
                PptxWatermark.ShapeLock.SelectLocked = true;
                PptxWatermark.ShapeLock.PositionLocked = true;
            }

            //Saving the image watermark PPTX  presentation file
            WatermarkPptxPresentation.Save(PathForWatermarkPptFile + "ImageWatermarkedPresentation.pptx",
                SaveFormat.Pptx);
        }
    }
}