How to Automatically Convert PPTX to PDF using Java

2 min readJun 9, 2022


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.




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