You may need to present your PDF document in the form of PowerPoint presentation slides. So, you can do this by easily converting your PDF file into a PowerPoint presentation programmatically on the cloud. This article will be focusing on how to convert PDF to PPTX using a REST API in Python.
The following topics shall be covered in this article:
- Document Conversion REST API and Python SDK
- PDF to PPTX Conversion using a REST API
- Convert PDF to PPTX and Download Directly
- Convert PDF to PPTX without using Cloud Storage
Document Conversion REST API and Python SDK
For Converting PDF to PPTX, I will be using the Python SDK of GroupDocs.Conversion Cloud API. It allows you to seamlessly convert your documents to any format you need. You can easily convert between over 50 types of documents and images, including all Microsoft Office and OpenDocument file formats, PDF documents, HTML, CAD, raster images, and many more. It also provides .NET, Java, PHP, Ruby, Android, and Node.js SDKs as its document conversion family members for the Cloud API.
You can install GroupDocs.Conversion Cloud to your Python project using the following command in the console:
pip install groupdocs_conversion_cloud
Please get your Client ID and Client Secret from the dashboard before you start following the steps and available code examples. Once you have your ID and secret, please add in the code as shown below:
PDF to PPTX Conversion using a REST API in Python
You can convert your PDF file into Powerpoint presentation slides by following the simple steps mentioned below:
- Upload the PDF file to the Cloud
- Convert PDF to PPTX in Python
- Download the converted file
Upload the Document
First of all, upload the PDF file to the Cloud using the code example given below:
As a result, the uploaded PDF file will be available in the files section of your dashboard on the cloud.
Convert PDF to PPTX in Python
Please follow the steps mentioned below to convert PDF documents to PPTX presentation programmatically.
- Create an instance of ConvertApi
- Create ConvertSettings instance
- Set the PDF file path
- Assign “pptx” to format
- Provide output file path
- Define PptxConvertOptions if required
- Create ConvertDocumentRequest
- Get results by calling the ConvertApi.convert_document() method
The following code example shows how to convert your PDF document to PPTX using a REST API.
You may also convert PDF files to a variety of other popular formats. Such as PDF to DOCX, PDF to XLSX, PDF to PNG, and PDF to JPG.
Download PowerPoint Presentation
The above code sample will save the converted PPTX presentation file on the cloud. You can download it using the following code sample:
Convert PDF to PPTX and Download Directly
Please follow the steps mentioned below to convert the PDF file to PPTX and to receive the converted file in API’s response.
- Create an instance of ConvertApi
- Create ConvertSettings instance
- Provide the PDF file path
- Assign “pptx” to format
- Set “None” to the output path
- Create ConvertDocumentRequest
- Get results by calling the ConvertApi.convert_document_download() method
The following code example shows how to convert your PDF document to PPTX using a REST API. The API shall return the converted PPTX file in response. Please follow the steps mentioned earlier to upload a file.
Convert PDF to PPTX without using Cloud Storage
Please follow the steps mentioned below to convert the PDF file to PPTX without using cloud storage.
- Create an instance of ConvertApi
- Create ConvertDocumentDirectRequest
- Get results by calling the ConvertApi.convert_document_direct() method
The following code example shows how to convert your PDF document to PPTX without using cloud storage. It means you will pass the input file in the request body and receive the output file in the API response.
Try Online
Please try the following free online PDF conversion tool, which is developed using the above API. https://products.groupdocs.app/conversion/
Conclusion
In this article, you have learned how to convert PDF documents to PPTX on the cloud with Document Conversion REST API using Python. You also learned how to programmatically upload the PDF file on the cloud and then download the converted file from the cloud. You can learn more about GroupDocs.Conversion Cloud API using the documentation. We also provide an API Reference section that lets you visualize and interact with our APIs directly through the browser. In case of any ambiguity, please feel free to contact us on the forum.