Protect PPTX Presentations with Python

Build Python applications that encrypt presentations or set write protection with Aspose.Slides.

Protect a PPTX Presentation with Python

Aspose.Slides for Python via .NET provides two distinct protection mechanisms. Call ProtectionManager.encrypt to encrypt a PPTX presentation and require a password to open it. Alternatively, call ProtectionManager.set_write_protection to discourage modification without encrypting the file. A user can still open a write-protected presentation and save changes to a different file.

Encrypt a PPTX Presentation - Python

with slides.Presentation("presentation.pptx") as presentation:
    presentation.protection_manager.encrypt("123123")
    presentation.save("encrypted-presentation.pptx", slides.export.SaveFormat.PPTX)

Set Write Protection on a PPTX Presentation - Python

with slides.Presentation("presentation.pptx") as presentation:
    presentation.protection_manager.set_write_protection("123123")
    presentation.save("write-protected-presentation.pptx", slides.export.SaveFormat.PPTX)

How to Protect PPTX with Python

Follow these steps to protect a PPTX file.

  1. Open the PPTX file with Presentation.
  2. Use ProtectionManager.encrypt to require a password for opening, or use ProtectionManager.set_write_protection to discourage changes.
  3. Save the protected presentation as PPTX with SaveFormat.PPTX.

Built with Aspose.Slides

Password-Protect PPTX Files Online

The free Aspose.Slides Lock app is built with Aspose.Slides for Python via .NET, the same API as the code above. Open it and see what the API can do with your own PPTX files.

  • Runs in your browser, nothing to install.
  • See how Aspose.Slides protects presentations before you write code.
  • Set a password to open or edit your PPTX file.
  • Download the protected file.

Other Supported Protection Formats

Use Python to protect other supported presentation formats.