Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active December 28, 2021 09:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-com-gists/cbc95264bf51d082800eca055e38cc5c to your computer and use it in GitHub Desktop.
Save aspose-com-gists/cbc95264bf51d082800eca055e38cc5c to your computer and use it in GitHub Desktop.
Convert PowerPoint PPTX or PPT to PDF in Python
import aspose.slides as slides
# Load presentation
pres = slides.Presentation("presentation.pptx")
# Create PDF options
options = slides.export.PdfOptions()
# Set PDF password and access permissions
options.password = "password"
options.access_permissions = slides.export.PdfAccessPermissions.PRINT_DOCUMENT | slides.export.PdfAccessPermissions.HIGH_QUALITY_PRINT
# Save PPTX as PDF
pres.save("pptx-to-protected-pdf.pdf", slides.export.SaveFormat.PDF, options)
import aspose.slides as slides
# Load presentation
pres = slides.Presentation("presentation.pptx")
# Create PDF options
options = slides.export.PdfOptions()
# Set desired compliance and save as PDF
options.compliance = slides.export.PdfCompliance.PDF_A1A
pres.save("pres-a1a-compliance.pdf", slides.export.SaveFormat.PDF, options)
options.compliance = slides.export.PdfCompliance.PDF_A1B
pres.save("pres-a1b-compliance.pdf", slides.export.SaveFormat.PDF, options)
options.compliance = slides.export.PdfCompliance.PDF_UA
pres.save("pres-ua-compliance.pdf", slides.export.SaveFormat.PDF, options)
import aspose.slides as slides
# Load presentation
pres = slides.Presentation("presentation.pptx")
# Create PDF options
options = slides.export.PdfOptions()
# Include hidden slides
options.show_hidden_slides = True
# Save PPTX as PDF
pres.save("pptx-to-pdf-hidden-slides.pdf", slides.export.SaveFormat.PDF, options)
import aspose.slides as slides
#Load presentation
pres = slides.Presentation("presentation.pptx")
# Set array of slides positions
slides_array = [ 1, 3 ]
# Save PPTX as PDF
pres.save("pptx-to-pdf-selected-slides.pdf", slides_array, slides.export.SaveFormat.PDF)
import aspose.slides as slides
# Load presentation
pres = slides.Presentation("presentation.pptx")
# Convert PPTX to PDF
pres.save("pptx-to-pdf.pdf", slides.export.SaveFormat.PDF)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment