How to Convert a Word Doc (97–03) to PDF using Java

2 min readOct 11, 2022


Older Microsoft Word Documents — specifically, 1997–2003 edition— are saved in a different format than the documents we use now, which makes converting them to new file formats a bit tricky. Thankfully, our suite of legacy Word Doc conversion APIs makes it easy to transition older file formats to ubiquitous destination formats — such as PDF — with ease. In this article, I’ll demonstrate how you can take advantage of our Word Doc (97–03) to PDF API for free using ready-to-run Java code examples from our API Console to structure your API call.

Our first step is to install the Document Conversion API client. We can do so by first adding a reference to the repository in pom.xml:


And then adding a reference to the dependency in pom.xml:


With installation complete, we can add the imports to the top of our file & call the function. In order to use this API for free, you’ll first need to register a free account on our website (this account comes with a limit of 800 API calls per month & zero additional commitments) and copy your API key into the appropriate field below (indicated by the code comments):

// 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.convertDocumentDocToPdf(inputFile);
} catch (ApiException e) {
System.err.println("Exception when calling ConvertDocumentApi#convertDocumentDocToPdf");

All you need to do now is include your inputFile path in the indicated field, and you’re all done — no more code required. Nice & easy!




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