Skip to main content

Java Client Library


The DynamicPDF API provides a full‑featured client library for Java that simplifies integration with the REST endpoints.
The Java client library is the official SDK for integrating the DynamicPDF API into Java applications and services. It provides intuitive Java classes and methods that allow developers to generate new PDFs, convert HTML and images to PDF, merge multiple documents, extract text and metadata, and perform thorough PDF inspection without manually writing raw HTTP requests.

Through this library, Java developers can use the complete functionality of the DynamicPDF API, including creating PDF documents programmatically, merging or splitting existing files, filling and flattening form fields, stamping text or images, retrieving XMP and document information, rasterizing PDF pages into images, and applying encryption or other security features. The DynamicPDF API delivers a full range of PDF focused endpoints that support creation, conversion, manipulation, analysis, and secure distribution of PDF content directly within Java applications.

The DynamicPDF API offers clean, intuitive wrappers around the following REST endpoints:

  • dlex-layout for creating dynamic PDF reports from DLEX templates and JSON data,
  • image-info for extracting detailed metadata from images,
  • pdf for creating and manipulating PDFs, merging documents, and converting HTML, Word, and Excel files to PDF,
  • pdf-info for retrieving document information and metadata from existing PDFs,
  • pdf-security-info for obtaining PDF encryption details and security settings,
  • pdf-text for extracting text content from PDF pages, and
  • pdf-xmp for reading embedded XMP metadata from PDF files.

Installation (Maven)

<dependency>
<groupId>com.dynamicpdf.api</groupId>
<artifactId>dynamicpdf-api</artifactId>
<version>1.12.0</version>
</dependency>

Usage Example

private static void Split(String apiKey) {
Pdf pdf = new Pdf();
pdf.setApiKey(apiKey);
PdfInput pdfInput = pdf.addPdf(new PdfResource("input.pdf"));
PdfResponse pdfResponse = pdf.process();
try {
FileUtils.writeByteArrayToFile("output.pdf", pdfResponse.getContent());
} catch (IOException e) {
HandleException(ex);
}
}
Source: SplitPdf.java