Convert PDF to PowerPoint in Python

Python PDF to PowerPoint and PPTX Conversion

Aspose.PDF for Python via .NET lets you track the progress of PDF to PPTX conversion.

We have an API named Aspose.Slides which offers the feature to create as well as manipulate PPT/PPTX presentations. This API also provides the feature to convert PPTX files to PDF format. During this conversion, the individual pages of the PDF file are converted to separate slides in the PPTX file.

During PDF to PPTX conversion, the text is rendered as Text where you can select/update it. Please note that in order to convert PDF files to PPTX format, Aspose.PDF provides a class named PptxSaveOptions. An object of the PptxSaveOptions class is passed as a second argument to the save(). The following code snippet shows the process for converting PDF files into PPTX format.

Simple conversion PDF to PowerPoint using Python and Aspose.PDF for Python via .NET

In order to convert PDF to PPTX, Aspose.PDF for Python advice to use the following code steps.

Steps: Convert PDF to PowerPoint in Python

  1. Create an instance of Document class.
  2. Create an instance of PptxSaveOptions class.
  3. Call the document.save() method.

    from os import path
    import aspose.pdf as apdf

    path_infile = path.join(self.data_dir, infile)
    path_outfile = path.join(self.data_dir, "python", outfile)

    document = apdf.Document(path_infile)
    save_options = apdf.PptxSaveOptions()
    document.save(path_outfile, save_options)

    print(infile + " converted into " + outfile)

Convert PDF to PPTX with Slides as Images

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.


    from os import path
    import aspose.pdf as apdf

    path_infile = path.join(self.data_dir, infile)
    path_outfile = path.join(self.data_dir, "python", outfile)

    document = apdf.Document(path_infile)
    save_options = apdf.PptxSaveOptions()
    save_options.slides_as_images = True

    document.save(path_outfile, save_options)

    print(infile + " converted into " + outfile)

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.

  1. Load the PDF into an ‘ap.Document’ object.
  2. Create a ‘PptxSaveOptions’ instance.
  3. Set the ‘image_resolution’ property to 300 DPI for high-quality rendering.
  4. Save the PDF as a PPTX file using the defined save options.

    from os import path
    import aspose.pdf as apdf

    path_infile = path.join(self.data_dir, infile)
    path_outfile = path.join(self.data_dir, "python", outfile)

    document = apdf.Document(path_infile)
    save_options = apdf.PptxSaveOptions()
    save_options.image_resolution = 300

    document.save(path_outfile, save_options)

    print(infile + " converted into " + outfile)