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 Java 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 Document.Save(..) method. 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

DIR_INPUT = "testdata/"
DIR_OUTPUT = "testout/"

input_pdf = DIR_INPUT + "Hello.pdf"
output_pdf = DIR_OUTPUT + "convert_pdf_to_pptx_with_options.pptx"
# Open PDF document
document = Api.Document(input_pdf)

save_options = Api.PptxSaveOptions()
save_options._ImageResolution = 300
save_options._SeparateImages = True
save_options._OptimizeTextBoxes = True

# Save the file into MS Word document format
document.save(output_pdf, 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 Aspose.Pdf.PptxSaveOptions class. To achieve this, set property SlidesAsImages of PptxSaveOptions class to ’true’ as shown in the following code sample.


DIR_INPUT = "testdata/"
DIR_OUTPUT = "testout/"

input_pdf = DIR_INPUT + "Hello.pdf"
output_pdf = DIR_OUTPUT + "convert_pdf_to_pptx_with_options.pptx"
# Open PDF document
document = Api.Document(input_pdf)

save_options = Api.PptxSaveOptions()
save_options._ImageResolution = 300
save_options._SlidesAsImages = True

# Save the file into MS Word document format
document.save(output_pdf, save_options)

See Also

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

Format: PowerPoint

Format: PPTX