How to validate a PowerPoint PPTX Presentation in Java

Today’s tutorial will demonstrate how to apply a Cloudmersive API to instantly begin validating PPTX files.

We will be begin by using Jitpack to dynamically compile our library. First we need a reference to the repository in our Maven POM file, as you see here:


Then a reference for our dependency:


Finally, all that’s left to do is call validateDocumentPptxValidation:

// Import classes:
//import com.cloudmersive.client.invoker.ApiClient;
//import com.cloudmersive.client.invoker.ApiException;
//import com.cloudmersive.client.invoker.Configuration;
//import com.cloudmersive.client.invoker.auth.*;
//import com.cloudmersive.client.ValidateDocumentApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();// Configure API key authorization: Apikey
ApiKeyAuth Apikey = (ApiKeyAuth) defaultClient.getAuthentication("Apikey");
Apikey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
ValidateDocumentApi apiInstance = new ValidateDocumentApi();
File inputFile = new File("/path/to/file.txt"); // File | Input file to perform the operation on.
try {
DocumentValidationResult result = apiInstance.validateDocumentPptxValidation(inputFile);
} catch (ApiException e) {
System.err.println("Exception when calling ValidateDocumentApi#validateDocumentPptxValidation");

Our response will include the validity of the file, definite errors, and warnings of possible problems.

Image for post
Image for post

Written by

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