Convert PDF to PowerPoint in Python
Convert PDF to PowerPoint in Python
Aspose.PDF for Python via .NET lets you convert PDF files to PowerPoint PPTX presentations from Python code.
Use this workflow when you need to repurpose PDF reports, slide decks, brochures, or handouts as PowerPoint files. During conversion, individual PDF pages are converted to separate slides in the PPTX file.
During PDF to PPTX conversion, text can be rendered as selectable text that you can update in PowerPoint. To convert PDF files to PPTX format, Aspose.PDF provides the PptxSaveOptions class. Pass a PptxSaveOptions object as the second argument to the save() method.
Convert PDF to PPTX in Python
To convert PDF to PPTX, use the following code steps.
Steps: Convert PDF to PowerPoint in Python
- Create an instance of Document class.
- Create an instance of PptxSaveOptions class.
- Call the document.save() method.
import aspose.pdf as ap
from os import path
import sys
def convert_PDF_to_PPTX(infile, outfile):
document = ap.Document(infile)
save_options = ap.PptxSaveOptions()
document.save(outfile, save_options)
Convert PDF to PPTX with Slides as Images
Try to convert PDF to PowerPoint online
Aspose.PDF provides an online “PDF to PPTX” application where you can test the conversion quality.
In case if you need to convert a searchable PDF to PPTX as images instead of selectable text, Aspose.PDF provides such a feature via PptxSaveOptions class. To achieve this, set property slides_as_images of PptxSaveOptions class to ’true’ as shown in the following code sample.
import aspose.pdf as ap
from os import path
import sys
def convert_PDF_to_PPTX_slides_as_images(infile, outfile):
document = ap.Document(infile)
save_options = ap.PptxSaveOptions()
save_options.slides_as_images = True
document.save(outfile, save_options)
Convert PDF to PPTX with Custom Image Resolution
This method converts a PDF document into a PowerPoint (PPTX) file while setting a custom image resolution (300 DPI) for improved quality.
- Load the PDF into an ‘ap.Document’ object.
- Create a ‘PptxSaveOptions’ instance.
- Set the ‘image_resolution’ property to 300 DPI for high-quality rendering.
- Save the PDF as a PPTX file using the defined save options.
import aspose.pdf as ap
from os import path
import sys
def convert_PDF_to_PPTX_image_resolution(infile, outfile):
document = ap.Document(infile)
save_options = ap.PptxSaveOptions()
save_options.image_resolution = 300
document.save(outfile, save_options)
Related conversions
- Convert PDF to Word for editable document output instead of slides.
- Convert PDF to Excel when the source PDF contains table-heavy business data.
- Convert PDF to HTML for browser-ready publishing workflows.
