Aspose.Slides  for Python via Java

Python PowerPoint API for Presentations

Create, read, modify, and convert PowerPoint and OpenOffice presentations using Python without external software.

  Download Free Trial

Aspose.Slides for Python via Java is a Python library for creating, modifying, and converting PowerPoint presentations. It supports presentation elements such as slides, shapes, text, charts, tables, images, SmartArt, OLE objects, multimedia, and VBA macros. The API also supports merging, cloning, splitting, comparing, rendering, and printing presentations without Microsoft PowerPoint.

Why Choose Aspose.Slides for Python via Java?

Aspose.Slides for Python via Java offers several advantages for PowerPoint automation:

  • Cross-platform compatibility: Use it on Windows, Linux, macOS, and other operating systems.
  • Easy integration and deployment: Integrate it with existing applications and deploy it on servers or cloud environments without Microsoft Office.
  • Powerful features and functionality: Create and modify slides, add and edit shapes, text, images, animations, transitions, charts, tables, and other elements, apply themes and layouts, insert audio and video, export and print presentations, export to video, and more.
  • High performance and quality: Process presentations efficiently while preserving output fidelity and accuracy.
  • Free trial and licensing options: Download the evaluation version and choose from licensing options such as developer, site, OEM, and cloud licenses.

Advanced Python PowerPoint API Features

Create or clone existing slides from templates

Work with PowerPoint tables via API

Apply or remove shape protection

Add Excel charts as OLE objects to slides

Create shapes and add text to shapes on slides

Handle text and shape formatting

Generate presentations from a database

Protect presentations and generated PDFs

Print presentations on a physical printer

System Requirements

Aspose.Slides for Python via Java is a platform-independent API. It can run on Windows, Linux, and macOS with the following software installed:
  • JDK 1.8 or above
  • Python 3.7 or above
  • JPype1 1.5.0 or above (JPype has been tested on Java versions from 1.8 to 11)

How to Install

Use PyPI to install the Aspose.Slides Python library for presentation processing from the PyPI repository:

pip install aspose-slides-java

How to Create New PowerPoint Presentation in Python

In the example given below, we have added a rectangle to the first slide of the presentation.

            
import jpype
import asposeslides

jpype.startJVM()

from asposeslides.api import Presentation, SaveFormat, ShapeType

presentation = Presentation()
slide = presentation.getSlides().get_Item(0)
slide.getShapes().addAutoShape(ShapeType.Rectangle, 50, 150, 300, 200)
presentation.save("presentation.pptx", SaveFormat.Pptx)
presentation.dispose()

jpype.shutdownJVM()
            
        

How to Merge Presentations in Python

This Python code shows you how to merge presentations:

            
import jpype
import asposeslides

jpype.startJVM()

from asposeslides.api import Presentation, SaveFormat

dstPresentation = Presentation("presentation1.pptx")
srcPresentation = Presentation("presentation2.pptx")

for slideIndex in range(srcPresentation.getSlides().size()):
    slide = srcPresentation.getSlides().get_Item(slideIndex)
    dstPresentation.getSlides().addClone(slide)

dstPresentation.save("combined_presentation.pptx", SaveFormat.Pptx)
dstPresentation.dispose()
srcPresentation.dispose()

jpype.shutdownJVM()
            
        

How to Import a Presentation from PDF in Python

This Python code demonstrates the PDF to PowerPoint conversion process:

            
import jpype
import asposeslides

jpype.startJVM()

from asposeslides.api import Presentation, SaveFormat

presentation = Presentation()

presentation.getSlides().removeAt(0)
presentation.getSlides().addFromPdf("welcome_to_powerpoint.pdf")

presentation.save("presentation.pptx", SaveFormat.Pptx)
presentation.dispose()

jpype.shutdownJVM()
            
        

How to Convert PowerPoint to PDF in Python

This Python code shows how to convert a PowerPoint or OpenOffice presentation to PDF using the default options.

            
import jpype
import asposeslides

jpype.startJVM()

from asposeslides.api import Presentation, SaveFormat

presentation = Presentation("presentation.pptx")

presentation.save("document.pdf", SaveFormat.Pdf)
presentation.dispose()

jpype.shutdownJVM()
            
        

How to Convert PowerPoint to JPG in Python

The following example shows you how to convert a PowerPoint PPT, PPTX, and OpenOffice ODP document into a set of JPEG images.

            
import jpype
import asposeslides

jpype.startJVM()

from asposeslides.api import Presentation, ImageFormat

presentation = Presentation("presentation.pptx")

for slideIndex in range(presentation.getSlides().size()):
    slide = presentation.getSlides().get_Item(slideIndex)
    slideImage = slide.getImage(2, 2)
    slideImage.save("slide_" + str(slideIndex) + ".jpg", ImageFormat.Jpeg)
    slideImage.dispose()

presentation.dispose()

jpype.shutdownJVM()
            
        
  

Support and Learning Resources