How to validate a PowerPoint PPTX Presentation in Ruby
1 min readAug 20, 2019
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'
endapi_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).