How to validate a PowerPoint PPTX Presentation in Ruby

Let’s look at how to validate PowerPoint files quickly and easily using Ruby. The first thing to do is add our API client to your Gemfile:

gem 'cloudmersive-convert-api-client', '~> 1.3.3'

Now just call validate_document_pptx_validation as you see below:

# load the gem
require 'cloudmersive-convert-api-client'
# setup authorization
CloudmersiveConvertApiClient.configure do |config|
# Configure API key authorization: Apikey
config.api_key['Apikey'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['Apikey'] = 'Bearer'
end
api_instance = CloudmersiveConvertApiClient::ValidateDocumentApi.newinput_file = File.new("/path/to/file") # File | Input file to perform the operation on.begin
#Validate a PowerPoint presentation (PPTX)
result = api_instance.validate_document_pptx_validation(input_file)
p result
rescue CloudmersiveConvertApiClient::ApiError => e
puts "Exception when calling ValidateDocumentApi->validate_document_pptx_validation: #{e}"
end

That’s all that you have to do. Your result will include the validity of the PowerPoint file, and any errors (making the file invalid) or warnings (things that might make the file invalid).

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