How to Automatically Convert PPTX to PDF using Java

Exporting PowerPoint PPTX files as PDF’s is a simple task within the PowerPoint application. Making that conversion automatically, however, requires a little extra effort. Our PPTX to PDF API is designed to integrate into your website/application to make that conversion quick and easy moving forward. With the code examples we’ve provided below, you can easily structure your API call with Java (or visit our API console page for similar complementary code in many additional programming languages).

First things first, let’s install the Java SDK with Maven. Add the below snippet to the repository in pom.xml:


Now add the below snippet to the dependency:


Finally, it’s time to include the import classes and call the function:

// 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.ConvertDocumentApi;
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)
ConvertDocumentApi apiInstance = new ConvertDocumentApi();
File inputFile = new File("/path/to/inputfile"); // File | Input file to perform the operation on.
try {
byte[] result = apiInstance.convertDocumentPptxToPdf(inputFile);
} catch (ApiException e) {
System.err.println("Exception when calling ConvertDocumentApi#convertDocumentPptxToPdf");

Not too difficult, right? No further code is required. If you don’t have an API key, you can get one by registering a free account on our website.



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


There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.