Aspose.Slides for Python via Java
Aspose.Slides for Python via Java is a library for creating, reading, editing and converting PowerPoint and OpenDocument presentations in Python applications, without Microsoft PowerPoint; it runs the Aspose.Slides Java engine in your Python process through JPype.
It loads and saves PPT, PPTX, PPS, POT and ODP, including macro-enabled and template variants, and exports to PDF, XPS, HTML, SVG, TIFF, Markdown and images.
Get Started
GETTING STARTED
EVALUATE
Build with Slides
COMMON TASKS
SLIDES WORKFLOWS
EXAMPLES
Reference & Support
REFERENCE
SUPPORT
Your first presentation
Install Python and a JDK, set JAVA_HOME, and create and activate a virtual environment as described in Installation. Then install JPype and Aspose.Slides from PyPI:
python -m pip install JPype1 aspose-slides-java
Save this code as hello.py. It starts the Java Virtual Machine, adds a cloud shape with text to the first slide of a new presentation, and saves the presentation:
import jpype
import asposeslides
if not jpype.isJVMStarted():
jpype.startJVM()
from asposeslides.api import Presentation, SaveFormat, ShapeType
# Create a presentation with one blank slide.
presentation = Presentation()
try:
# Get the first slide.
slide = presentation.getSlides().get_Item(0)
# Add a cloud shape and set its text.
auto_shape = slide.getShapes().addAutoShape(ShapeType.Cloud, 20, 20, 200, 80)
auto_shape.getTextFrame().setText("Hello, Aspose!")
# Save the presentation as a PPTX file.
presentation.save("new_presentation.pptx", SaveFormat.Pptx)
finally:
presentation.dispose()
Run it in the same virtual environment:
python hello.py
The script saves new_presentation.pptx with one slide holding a cloud shape with the text “Hello, Aspose!”. Without a license, the saved file also carries an evaluation watermark — see Licensing. For more ways to create and fill a presentation, see Create Presentations.