How to Convert PowerPoint PPT (97–03) to PPTX using Java

Cloudmersive
2 min readOct 13, 2022

Office applications have changed a lot over the years. If you’re still digging up relevant PowerPoint presentations from the turn of the Millennium, chances are you’ve noticed that those files don’t like to open the way they used to. Thankfully, with our PPT (97–03) to PPTX API, you can quickly & easily convert legacy PowerPoint files to a modern, usable format with zero hassle. Our API is free to use; just follow instructions below to structure your API call using ready-to-run Java code examples and create a free account on our website to get & authenticate your Cloudmersive API key.

Let’s start by installing the API client with Maven. Our first step is to add a reference to the repository in pom.xml:

<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>

After that, we just need to add another reference to the pom.xml dependency, and installation is all done:

<dependencies>
<dependency>
<groupId>com.github.Cloudmersive</groupId>
<artifactId>Cloudmersive.APIClient.Java</artifactId>
<version>v4.25</version>
</dependency>
</dependencies>

Now we can call the function. First, let’s include the imports at the top of our file, and then let’s add our API key & inputFile path in the appropriate fields:

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

And poof — just like that, you’re all done. No more code required!

--

--

Cloudmersive

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