Convert PDF to PowerPoint in Python

Overview

Is it possible to convert a PDF file into a PowerPoint? Yes, you can! And it’s easy! This article explains how to convert PDF to PowerPoint using Python. It covers these topics.

Format: PPTX

Format: PowerPoint

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 PPT/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

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 | Steps: Convert PDF to PPTX in Python

  1. Create an instance of Document class
  2. Create an instance of PptxSaveOptions class
  3. Use the Save method of the Document object to save the PDF as PPTX

    import aspose.pdf as ap

    input_pdf = DIR_INPUT + "sample.pdf"
    output_pdf = DIR_OUTPUT + "convert_pdf_to_pptx.pptx"
    # Open PDF document
    document = ap.Document(input_pdf)
    # Instantiate PptxSaveOptions instance
    save_option = ap.PptxSaveOptions()
    # Save the file into MS PowerPoint format
    document.save(output_pdf, save_option)

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

    input_pdf = DIR_INPUT + "sample.pdf"
    output_pdf =  DIR_OUTPUT + "convert_pdf_to_pptx_with_slides_as_images.pptx"
    # Open PDF document
    document = ap.Document(input_pdf)
    # Instantiate PptxSaveOptions instance
    save_option = ap.PptxSaveOptions()
    save_option.slides_as_images = True
    # Save the file into MS PowerPoint format
    document.save(output_pdf, save_option)

See Also

This article also covers these topics. The codes are same as above.

Format: PowerPoint

Format: PPTX