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

Add Watermarks to ODP Presentations with Python

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

Add a Watermark to an ODP Presentation with Python

With Aspose.Slides for Python via .NET , you can add a text or image watermark to an ODP presentation without using OpenOffice. 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 an ODP Presentation - Python

with slides.Presentation("presentation.odp") 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.odp", slides.export.SaveFormat.ODP)

Add an Image Watermark to an ODP Presentation - Python

with slides.Presentation("presentation.odp") 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.odp", slides.export.SaveFormat.ODP)

How to Add a Watermark to ODP via Python

Follow these steps to add a text watermark to an ODP presentation.

  1. Open the ODP 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.ODP to write the watermarked presentation.

Other Supported Watermark Formats

Use Python to add watermarks to other supported presentation formats.