This short tutorial guides on how to convert multiple PPT files to PDF using Python along with the detailed configuration steps to set up the environment. You can convert multiple PPT to one PDF in Python with the help of a few API calls only and will have control over each slide that is included in the PDF like filtering some slides or setting some other properties if needed.
Steps to Convert Multiple PPT Files to PDF using Python
- Setup your IDE environment to use Aspose.Slides for Python via .NET
- Add the reference to glob, os and aspose.slides namespaces in your project to convert PPT to PDF
- Create a default presentation using the Presentation class and remove its default slide
- Access the list of all the presentation files to be rendered into a single PDF
- Iterate through each presentation file and load it into a separate temporary Presentation object
- Iterate through all the slides in each presentation and clone them into the destination presentation
- Save the final resultant presentation as a PDF containing slides from all the presentations
These step-by-step instructions are followed to convert multiple PPT files to PDF in Python. A complete workflow is described to write a converter, where a new default presentation is created which is followed by the removal of its default slide. Then, you may load single or multiple presentations, accessing their respective slide collections and adding them to the target presentation using the slide cloning feature before saving that on the disk as a PDF file.
Code to Convert Multiple PPT to One PDF using Python
This code exhibits how to convert multiple PPT to PDF in Python by using the required namespaces and classes. The code includes the logic to read PPT files only from a folder however, you may simplify it by getting the list of file names some other way too as per your requirements. During the slides iteration, when you get access to each slide you can also set the properties like add slide background, add some ActiveX control, work with the shapes on the slide, and so on.
We have witnessed that while writing PPT to PDF converter multiple files in Python are rendered to a single PDF. If you want to learn about converting presentations to SVG, refer to the article on how to convert PowerPoint to SVG in Python.