PPT
PPTX
ODP
POT
PPSX
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.
Open the ODP file with
Presentation.Get the first master slide from the
masterscollection.Call
add_auto_shapeto add a rectangle to the master slide.Call
add_text_frameto add the watermark text, then format and lock the shape.Call
savewithSaveFormat.ODPto write the watermarked presentation.