PDF format is very much in the business for creating and sharing digital documents. Since it provides cross-platform support, people opt to send and receive documents in PDF format. There could be the case when you need to import the content from a PDF file to another document such as Word, PowerPoint, etc. To accomplish this programmatically, in this article, you will learn how to convert a PDF file to PowerPoint PPT/PPTX in Python.
Python Library for PDF to PowerPoint PPT Conversion
Aspose.Slides for Python is an amazing library that provides basic as well as advanced features to create and manipulate PowerPoint presentations. In addition, it provides high-fidelity conversion of presentations to other formats. We will use this library to import content from PDF to PPT/PPTX slides. You can install the library from PyPI using the following command.
> pip install aspose.slides
Convert PDF to PowerPoint PPT in Python
In PDF to PowerPoint conversion, you do not need to go through the pages in PDF to import the content. Instead, Aspose.Slides for Python takes care of these operations and makes the conversion quite easier for you. The following is the workflow of PDF to PPT conversion.
- Create an empty presentation.
- Specify a PDF to import into presentation.
- Aspose.Slides fetches the PDF pages and converts them to the slides.
- Save presentation.
The following are the steps to convert a PDF file to PowerPoint PPTX in Python.
- Create a new presentation using Presentation class.
- Remove the default slide added to the presentation using Presentation.slides.remove_at(0) method.
- Import PDF to the presentation using Presentation.slides.add_from_pdf(string) method.
- Save the presentation as a PPT/PPTX file using Presentation.save(string, SaveFormat) method.
The following code sample shows how to convert a PDF file to a PowerPoint presentation in Python.
The following is the PDF that we took to convert into the PowerPoint PPTX.
Below is the PowerPoint presentation that we get after importing the PDF file.
Get a Free License
You can use Aspose.Slides for Python without evaluation limitations by getting a temporary license.
In this article, you have learned how to convert a PDF file to PowerPoint PPT/PPTX in Python. We have demonstrated how Aspose.Slides for Python converts each page in PDF to a slide in PowerPoint PPT. Besides, you can visit the documentation to explore more about Aspose.Slides for Python. Also, you can post your queries to our forum.