News Category

Remove text and image watermarks in presentation slides

2018-05-28 08:26:29 Written by  support iceblue
Rate this item
(0 votes)

We have demonstrated how to use Spire.Presentation to add text watermark and image watermark to the presentation slides. This article will show how to remove text and image watermarks in presentation slides in C#.

Firstly, view the sample document contains the text and image watermark.

Remove text and image watermarks in presentation slides

Step 1: Create a presentation document and load the document from the file

Presentation ppt = new Presentation();
ppt.LoadFromFile("Sample.pptx", FileFormat.Pptx2013);

Step 2: Remove the text and image watermark.

Remove text watermark by removing the shape with contains the text string "Confidential".

for (int i = 0; i < ppt.Slides.Count; i++)
{
    for (int j = 0; j < ppt.Slides[i].Shapes.Count; j++)
    {
        if (ppt.Slides[i].Shapes[j] is IAutoShape)
        {
            IAutoShape shape = ppt.Slides[i].Shapes[j] as IAutoShape;
            if (shape.TextFrame.Text.Contains("Confidential"))
            {
                ppt.Slides[i].Shapes.Remove(shape);
            }
        }
    }
}

Remove image watermark by setting SlideBackground.Fill.FillType as none.

for (int i = 0; i < ppt.Slides.Count; i++)
{
    ppt.Slides[i].SlideBackground.Fill.FillType = FillFormatType.None;
}

Step 3: Save the document to file.

ppt.SaveToFile("RemoveWartermark.pptx", FileFormat.Pptx2013);

Effective screenshot after removing the text and image watermark:

Remove text and image watermarks in presentation slides

Remove text and image watermarks in presentation slides

Full codes:

Remove text watermark in presentation slides:

using Spire.Presentation;
namespace RemoveWatermark
{

    class Program
    {

        static void Main(string[] args)
        {
            Presentation ppt = new Presentation();
            ppt.LoadFromFile("Sample.pptx", FileFormat.Pptx2013);

            for (int i = 0; i < ppt.Slides.Count; i++)
            {
                for (int j = 0; j < ppt.Slides[i].Shapes.Count; j++)
                {
                    if (ppt.Slides[i].Shapes[j] is IAutoShape)
                    {
                        IAutoShape shape = ppt.Slides[i].Shapes[j] as IAutoShape;
                        if (shape.TextFrame.Text.Contains("Confidential"))
                        {
                            ppt.Slides[i].Shapes.Remove(shape);
                        }
                    }
                }
            }
            ppt.SaveToFile("RemoveTextWartermark.pptx", FileFormat.Pptx2013);
        }
    }

Remove image watermark in presentation slides:

using Spire.Presentation;
using Spire.Presentation.Drawing;
namespace RemoveWatermark
{

    class Program
    {

        static void Main(string[] args)
        {
            Presentation ppt = new Presentation();
            ppt.LoadFromFile("Sample2.pptx", FileFormat.Pptx2013);

            for (int i = 0; i < ppt.Slides.Count; i++)
            {
                ppt.Slides[i].SlideBackground.Fill.FillType = FillFormatType.None;
            }

            ppt.SaveToFile("RemovePicWatermak.pptx", FileFormat.Pptx2013);

        }
    }
}

Additional Info

  • tutorial_title:
Last modified on Friday, 24 September 2021 09:29