PPTX to PDF and PDF to PPT conversion in Python

PowerPoints are a popular format of information presentations and corporate briefings. The PowerPoint slides enable you to individually specify various information types on separate slides. But in order to view the presentations, you need to have specific software. As a workaround, you may consider converting PowerPoint (PPT) files to Portable Document Format (PDF) which ensures document fidelity and vivid display of the content. PDF files are popular because they provide the same user experience irrespective of the platform and device being used.

At the same time, if you desire to convert PDF files to PPT format, either you copy individual file objects and place them inside the PPT file or manually create the content. However, a more viable solution is to programmatically render the source PDF to PPT format. In this approach, the formatting of the document is not disturbed. Also, when you need to perform bulk conversion operations, the utilization of an API is an effective and time-saving solution.

PowerPoint processing API

Aspose.Slides Cloud is a remarkable API offering the capabilities to programmatically create, manipulate and save PowerPoint presentations to various popular formats including PDF, XPS, JPEG, SVG, HTML, etc. It supports all major PowerPoint formats including Microsoft (PPTX, PPSX, POTX, POT, etc) and OpenDocument Presentation formats (ODP, OTP). For further details, please visit Supported Document Formats.

In order to facilitate programmers, specific programming SDKs are developed on top of Cloud API. For more details, please visit Available SDKs.

Installation

In this article, we are going to discuss the PowerPoint conversion to PDF and vice versa conversion using Aspose.Slides Cloud SDK for Python. The SDK is available for download from PIP and GitHub. Execute the following command on the command line terminal to install the SDK.

pip install asposeslidescloud

In case you are using PyCharm IDE, simply search asposeslidescloud on Python Interpreter window under PyCharm -> Preferences… section.

Aspose.Slides Cloud SDK for Python

Now in order to use the SDK, the next step is to obtain your personalised ClientID and ClientSecret details. Therefore, the first step is to create an account by visiting Aspose.Cloud dashboard. If you have GitHub or Google account, simply Sign Up. Otherwise, click on the Create a new Account button and provide the required information. Now login to the dashboard using credentials and expand the Applications section from the dashboard and scroll down towards the Client Credentials section to see Client ID and Client Secret details.

Client Credentials details

PPTX to PDF conversion in Python

Aspose.Slides Cloud SDK for Python is so powerful that you can accomplish the PPTX to PDF conversion process with just a few code lines. Please follow the instructions below to fulfill your requirements.

  • The first step is to create an instance of the Configuration class
  • Specify the Client ID and Client Secret details using app_sid and app_key properties (app_sid = Client Id and app_key = Client Secret)
  • Now initialize an object of SlidesApi while passing Configuration object as an argument
  • The next step is to read the PPTX file from the local system
  • Penultimate, create an object of PutSlidesConvertConvertRequest which takes input PPTX, PDF value from ExportFormat enumeration, and resultant file name as arguments
  • Finally, call the put_slide_convert(..) method of SlidesApi to perform the conversion

Convert PDF to PPT format in Python

Aspose.Slides Cloud SDK for Python is so exciting that it enables the developers to load PDF files and save them as PowerPoint presentations. The conversion is performed using PostSlidesDocumentFromPdf API. Please follow the steps given below to accomplish the requirements.

  • First of all, we need to create an instance of the SlidesApi instance by providing Configuration object
  • Secondly, load the input PDF document to file instance
  • Thirdly, create an object of PostSlidesDocumentFromPdfRequest which takes the name of the resultant PPTX and input PDF file as arguments
  • Finally, call the post_slides_document_from_pdf method of SlidesApi to perform the conversion

The sample documents used in above example are available for download on following links

PDF to PPTX conversion

Conclusion

In this article, we have discussed the amazing features of PowerPoint conversion to PDF format and vice versa. Apart from this conversion, it also provides you the feature to Create a PowerPoint presentation from HTML Document, using a template, and much more. The complete source code of SDK is available for download on GitHub. Should you have any related queries while using the API, please feel free to contact us via a free customer support forum.

Related articles

We also recommend visiting following links for information on