PPT
PPTX
ODP
POT
PPSX
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.
Open the PPT 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.PPTto write the watermarked presentation.