SelectPdf Online REST API – Java Client Library

SelectPdf Online REST API is a platform independent PDF manipulation API. SelectPdf REST API is cloud based and it can be used with any language: .NET (C# or VB.NET), Java, PHP, Python, Go, Ruby, Node.js, Perl and many more. We are presenting today the dedicated Java client library for SelectPdf API.

SelectPdf Java client library can be used to take advance of the features offered by SelectPdf Online REST API:

HTML to PDF REST API – Use SelectPdf HTML To PDF Online REST API to generate PDF documents from web page urls or raw HTML code.

PDF to TEXT REST API – SelectPdf Pdf To Text REST API is a cloud based solution that can be used to extract text from PDF documents or search PDF documents for specific words.

PDF Merge REST API – SelectPdf Pdf Merge REST API is an online solution that can be used to merge local or remote PDFs into a final PDF document.

All these APIs can be easily integrated with Java code and applications using the dedicated client library.

Installation

Download selectpdf-api-java-client-1.4.0.zip, unzip it and copy selectpdf-api-java-client-1.4.0.jar to your CLASSPATH.

OR

Install SelectPdf Java Client for Online API via Maven: SelectPdf on Maven.

<dependency>
<groupId>com.selectpdf</groupId>
<artifactId>selectpdf-api-client</artifactId>
<version>1.4.0</version>
</dependency>

OR

Install the client library by Gradle (e.g. for Android Studio) from Maven by adding the following line to your Gradle dependencies:

implementation ‘com.selectpdf:selectpdf-api-client:1.4.0’

OR

Clone selectpdf-api-java-client from Github and install the library.

git clone https://github.com/selectpdf/selectpdf-api-java-client
cd selectpdf-api-java-client
mvn install

Get a trial key for SelectPdf online REST API

Once the library is installed, you need a key to be able to access the API.

GET A DEMO LICENSE KEY NOW
The free trial key for the online API is valid for 7 days and it includes 200 conversions.

Sample Code

The Java client library makes accessing SelectPdf online REST API very easy. Here are a few samples that present the main features of the API. For details and full list of parameters access the online documentation of the client library or the individual pages of the APIs: HTML to PDF API or PDF to TEXT API or PDF Merge API.

Convert HTML to PDF in Java

The following sample shows the main features of the HTML To PDF API. Comment/uncomment code to convert an url to file or memory or also convert raw HTML to file or memory.

Convert HTML to PDF with custom header/footer in Java

The following sample shows how to convert a web page to PDF and also setting a custom header or footer.

Extract text from PDF in Java

The following sample shows how to extract the text from a PDF document using SelectPdf API. Comment/uncomment code to convert a local PDF or a PDF from a remote url to file or memory.

Search for text in PDF using Java

The following sample shows how to search a PDF document for a specific text.

Merge PDFs using Java

The following sample shows how merge several PDF documents into a final file. The source PDFs can be local files or PDFs from remote urls. The final PDF can be retrieved in memory or saved to a local file.

The above Java samples can also be found in GitHub repository: Java Samples.