How to Get PDF Document Metadata using Java

1 min readJun 15, 2022



Want your application to get more out of PDF files? Take advantage of our PDF Metadata API to streamline the process of opening and extracting PDF properties. You can easily implement this API as a cloud service using the below code to structure your API call in Java.

First, begin Maven installation by including a reference in the pom.xml repository:


Next, let’s include a reference in the pom.xml dependency:


After that, copy in the import classes:

// 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.EditPdfApi;

Finally, call the API, including the following parameters:

  1. Your input file
  2. Your Cloudmersive API key (obtainable by registering a free account on our website)
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)
EditPdfApi apiInstance = new EditPdfApi();
File inputFile = new File("/path/to/inputfile"); // File | Input file to perform the operation on.
try {
PdfMetadata result = apiInstance.editPdfGetMetadata(inputFile);
} catch (ApiException e) {
System.err.println("Exception when calling EditPdfApi#editPdfGetMetadata");




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