How to Split a PowerPoint Presentation into Separate Slides using Java

2 min readSep 2, 2022


Splitting larger files into smaller & more manageable files is an easy way to reduce clutter and/or create quick spinoff projects. This is a particularly useful operation when it comes to PowerPoint slides, which are just as commonly used as sandbox templates for marketing materials as for their intended presentation purpose. Thankfully, there’s an API for that — our PowerPoint PPTX Split API will return a single file (or URL, if the optional ‘returnDocumentContents’ parameter is set to False) for each slide in a PPTX presentation. With a secure Cloudmersive API key (visit our website & register a free account to get one), you can take advantage of this API for free & structure your API call using Java code examples as demonstrated below.

We can begin installing the SDK with Maven by first adding a reference to the pom.xml repository:


And then adding a reference to the dependency:


Next we can add the imports to the top of our file, configure the API key & input file parameters, 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.SplitDocumentApi;
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)
SplitDocumentApi apiInstance = new SplitDocumentApi();
File inputFile = new File("/path/to/inputfile"); // File | Input file to perform the operation on.
Boolean returnDocumentContents = true; // Boolean | Set to true to return the contents of each presentation directly, set to false to only return URLs to each resulting presentation. Default is true.
try {
SplitPptxPresentationResult result = apiInstance.splitDocumentPptx(inputFile, returnDocumentContents);
} catch (ApiException e) {
System.err.println("Exception when calling SplitDocumentApi#splitDocumentPptx");

With that, you’re all set — you can easily split up PPTX presentations at scale.




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