Java Client

Step 1 - Add the Client with the Package Manager

Add the Java client to your Maven POM file:

Add a reference to the repository (we use Jitpack to dynamically compile the library from Github source):

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

Add a reference to the dependency:

<dependencies>
<dependency>
<groupId>com.github.Cloudmersive</groupId>
<artifactId>Cloudmersive.APIClient.Java</artifactId>
<version>v2.20</version>
</dependency>
</dependencies>

Add it in your root build.gradle at the end of repositories:

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Add the dependency:

dependencies {
        implementation 'com.github.Cloudmersive:Cloudmersive.APIClient.Java:v2.20'
}

Step 2 - Create an API Client object with API Key

Import the API Client package by adding this line to the top of your .java file:

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;
 

Get your API Key (available in your Account Dashboard) and instantiate the API Client object:

ApiClient defaultClient = Configuration.getDefaultApiClient();

ApiKeyAuth Apikey = (ApiKeyAuth) defaultClient.getAuthentication("Apikey");
Apikey.setApiKey("YOUR API KEY");


Step 3 - Call an API

Let's try calling the email validation API to check if this email address exists:
ConvertDocumentApi apiInstance = new ConvertDocumentApi();
File inputFile = new File("C:\\temp\\input.docx"); // File | Input file to perform the operation on.
try {
    byte[] result = apiInstance.convertDocumentDocxToPdf(inputFile);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling ConvertDocumentApi#convertDocumentDocxToPdf");
    e.printStackTrace();
}


Sample Application

Download Console Sample or Download Android Sample

You can also download our sample application from GitHub.

50,000 free API calls/month, no credit card required

Get started now!