How to convert a PowerPoint PPT 97–03 Presentation to PDF in Python

Nobody likes dealing with outdated file formats, and you really shouldn’t have to. That’s why today’s post is going to show you how to implement a method for converting PPTs into the more useful PDF format. You only need to budget a few minutes for this solution.

Begin with installation of the client, like so:

pip install cloudmersive-convert-api-client

For today’s goal, we are going to need convert_document_ppt_to_pdf, which we can call with something along these lines here:

from __future__ import print_functionimport timeimport cloudmersive_convert_api_clientfrom import ApiExceptionfrom pprint import pprint# Configure API key authorization: Apikeyconfiguration = cloudmersive_convert_api_client.Configuration()configuration.api_key['Apikey'] = 'YOUR_API_KEY'# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed# configuration.api_key_prefix['Apikey'] = 'Bearer'# create an instance of the API classapi_instance = cloudmersive_convert_api_client.ConvertDocumentApi(cloudmersive_convert_api_client.ApiClient(configuration))input_file = '/path/to/file' # file | Input file to perform the operation on.try:# Convert PowerPoint PPT (97-03) Presentation to PDFapi_response = api_instance.convert_document_ppt_to_pdf(input_file)pprint(api_response)except ApiException as e:print("Exception when calling ConvertDocumentApi->convert_document_ppt_to_pdf: %s\n" % e)

And that is how the cookie crumbles. If you need to convert PPT to PPTX, or deal with other Office document files, then the rest of this library will be right up your alley.

Image for post

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store