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 cloudmersive_convert_api_client.rest 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.