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

  1. Create an instance of Document class.
  2. Create an instance of PptxSaveOptions class.
  3. 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

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.

  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.
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)