How to Validate a Legacy PowerPoint PPT Presentation in Python
Older PowerPoint presentations (specifically, PPT 97–03 format) follow a different schema than modern PowerPoint presentations (PPTX format) do, and as a result they require a separate document validation method. Thankfully, the below PPT validation API is free to use, and will quickly dig into PPT files to find out if they’re properly or improperly formatted. This API will also identify if the file is password protected, contains any specific errors and warnings, and more.
To take advantage of this API in Python, you can first install the SDK using the below command:
pip install cloudmersive-convert-api-client
Next, you can copy in the imports and the function included below:
from __future__ import print_function
import time
import cloudmersive_convert_api_client
from cloudmersive_convert_api_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: Apikey
configuration = cloudmersive_convert_api_client.Configuration()
configuration.api_key['Apikey'] = 'YOUR_API_KEY'
# create an instance of the API class
api_instance = cloudmersive_convert_api_client.ValidateDocumentApi(cloudmersive_convert_api_client.ApiClient(configuration))
input_file = '/path/to/inputfile' # file | Input file to perform the operation on.
try:
# Validate a PowerPoint 97-2003 Legacy presentation (PPT)
api_response = api_instance.validate_document_ppt_validation(input_file)
pprint(api_response)
except ApiException as e:
print("Exception when calling ValidateDocumentApi->validate_document_ppt_validation: %s\n" % e)
Just like that, you’re all done! To use this API for free as indicated above, you’ll just need to create a free account on our website and include your free-tier API key in the configuration.api_key field above. Free-tier API keys will supply a limit of 800 API calls per month, and once you reach that limit the total will reset the following month (there are no additional commitments).