
PDF is a widely used, cross‑platform file format that retains document layout regardless of the operating system. Converting PowerPoint presentations to PDF is a frequent requirement for reliable sharing and archiving. To automate this process, we’ll demonstrate how to convert PPT or PPTX files to PDF using Python and explore advanced options such as hidden slides, selective slide conversion, PDF compliance settings, and password protection.
- Python PPT to PDF Converter Library
- Convert a PowerPoint PPTX File to PDF
- Include Hidden Slides in PPTX to PDF Conversion
- Convert Selected Slides in PPTX to PDF
- Set PDF Compliance in PPT to PDF Conversion
- Convert PPTX to Password-protected PDF
Python PPT to PDF Converter Library
To perform PowerPoint‑to‑PDF conversion, we use Aspose.Slides for Python via .NET5. This robust library enables full‑featured presentation manipulation directly from Python code. Install it from PyPI with a single command:
> pip install aspose.slides
Read more about the system requirements for this library.
Info: In addition to converting PPT to PDF, Aspose.Slides can convert PDFs to JPG, PNG, SVG, or other image formats, and export PDFs to HTML, XML, or various image types. It also supports importing images to create PDFs.
Convert a PPT to PDF in Python
Converting a presentation to PDF is straightforward: load the file and save it in PDF format. Follow these steps:
- Load the PPT/PPTX file using the Presentation class.
- Save the presentation as PDF with Presentation.save(outputPath, export.SaveFormat.PDF).
The code sample below demonstrates the complete conversion process.
The screenshot below shows the original PPTX file used in this example.

PPTX Presentation
And here is the resulting PDF after conversion.

PPTX Converted to PDF
Notice that the third slide, which is hidden in the source file, is omitted from the PDF. If you need to include hidden slides, see the next section.
Include Hidden Slides - Python PPTX to PDF
Aspose.Slides provides the PdfOptions class to control PDF output. To include hidden slides, follow these steps:
- Load the PPTX with Presentation.
- Create a PdfOptions instance.
- Set PdfOptions.show_hidden_slides = True.
- Save the presentation using Presentation.save(outputPath, export.SaveFormat.PDF, pdfOptions).
The sample below illustrates how to enable hidden slides during conversion.
Convert Selected Slides of PPT to PDF in Python
When only specific slides need to be exported, pass an array of slide indices to the save method. Steps:
- Load the PPTX with Presentation.
- Define a list of slide numbers, e.g., slides_numbers = [1, 3].
- Call Presentation.save(outputPath, slides_numbers, export.SaveFormat.PDF).
The following code converts only the chosen slides to PDF.
Set PDF Compliance in PPT to PDF Conversion
You can enforce a specific PDF/A or PDF/X compliance level using PdfOptions.compliance. Perform these steps:
- Load the PPTX with Presentation.
- Instantiate PdfOptions.
- Assign PdfOptions.compliance = export.PdfCompliance.PdfA1b (or another enum value).
- Save the file with the configured options.
The code example below shows how to set PDF compliance.
Convert PPT to Password-protected PDF in Python
To protect the generated PDF, set a password and define access permissions via PdfOptions. Follow these steps:
- Load the PPTX using Presentation.
- Create a PdfOptions object.
- Set PdfOptions.password = “yourPassword”.
- Optionally configure PdfOptions.access_permissions to restrict editing, printing, etc.
- Save the presentation as PDF with the security options.
The snippet below demonstrates password protection.
Get a Free License
You can try Aspose.Slides for Python via .NET at no cost by obtaining a temporary license.
Conclusion
This article covered how to convert PPT or PPTX files to PDF using Python and Aspose.Slides. You learned to include hidden slides, export selected slides, enforce PDF compliance standards, and add password protection with access permissions. Explore additional features and detailed documentation through the official docs. If you have questions, join the discussion on our forum.
See Also
Tip: Try the free Aspose PowerPoint to PDF converter.