PPT PPTX ODP POT PPSX
Aspose.Slides  for Python via .NET
PPT

Add Watermarks to PPT Presentations with Python

Build Python applications that add text or image watermarks to PPT presentations with Aspose.Slides.

Add a Watermark to a PPT Presentation with Python

With Aspose.Slides for Python via .NET , you can add a text or image watermark to a PPT presentation without using Microsoft PowerPoint. A watermark can identify ownership, mark a presentation as confidential or a draft, or provide consistent branding. The examples below place the watermark on the first master slide, so it appears on slides that use that master.

Add a Text Watermark to a PPT Presentation - Python

with slides.Presentation("presentation.ppt") as presentation:
    master_slide = presentation.masters[0]
    watermark_shape = master_slide.shapes.add_auto_shape(slides.ShapeType.RECTANGLE, 100, 100, 400, 50)
    watermark_text_frame = watermark_shape.add_text_frame("CONFIDENTIAL")

    watermark_shape.fill_format.fill_type = slides.FillType.NO_FILL
    watermark_shape.line_format.fill_format.fill_type = slides.FillType.NO_FILL

    watermark_portion = watermark_text_frame.paragraphs[0].portions[0]
    watermark_portion.portion_format.font_height = 32

    watermark_shape.auto_shape_lock.select_locked = True
    watermark_shape.auto_shape_lock.size_locked = True
    watermark_shape.auto_shape_lock.text_locked = True
    watermark_shape.auto_shape_lock.position_locked = True
    watermark_shape.auto_shape_lock.grouping_locked = True

    presentation.save("watermarked.ppt", slides.export.SaveFormat.PPT)

Add an Image Watermark to a PPT Presentation - Python

with slides.Presentation("presentation.ppt") as presentation:
    with open("watermark.png", "rb") as image_stream:
        watermark_image = presentation.images.add_image(image_stream.read())

    master_slide = presentation.masters[0]
    watermark_shape = master_slide.shapes.add_auto_shape(
        slides.ShapeType.RECTANGLE, 100, 100, watermark_image.width, watermark_image.height)

    watermark_shape.fill_format.fill_type = slides.FillType.PICTURE
    watermark_shape.fill_format.picture_fill_format.picture.image = watermark_image
    watermark_shape.fill_format.picture_fill_format.picture_fill_mode = slides.PictureFillMode.STRETCH
    watermark_shape.line_format.fill_format.fill_type = slides.FillType.NO_FILL

    presentation.save("watermarked.ppt", slides.export.SaveFormat.PPT)

How to Add a Watermark to PPT via Python

Follow these steps to add a text watermark to a PPT presentation.

  1. Open the PPT file with Presentation.

  2. Get the first master slide from the masters collection.

  3. Call add_auto_shape to add a rectangle to the master slide.

  4. Call add_text_frame to add the watermark text, then format and lock the shape.

  5. Call save with SaveFormat.PPT to write the watermarked presentation.

Other Supported Watermark Formats

Use Python to add watermarks to other supported presentation formats.