Skip to content

pdf4me client api in java, creating expert pdfs from online to batch

License

Notifications You must be signed in to change notification settings

pdf4me/pdf4me-clientapi-java

Repository files navigation

Pdf4me.Client - the java library for the Pdf4me Saas API

Maven Central license Maintenance Build

The Pdf4me Client API is a maven library which connects to its highly scalable SaaS cloud service with many functionalities to solve your document and PDF requirements. The SaaS API provides expert functionality to convert, optimize, compress, produce, merge, split, ocr, enrich, archive, print documents and PDF's.

Feature Description
Optimize PDF's can often be optimized by removing structural redundancy. This leads to much smaller PDF's
Merge Multiple PDF's can be merged into single optimized PDFs.
Split A PDF can be splitted into multiple PDF's.
Convert to PDF Convert your documents from any format to a proper PDF document.
Extract From a PDF extract multiple pages into a new document.
Images Extract images from your document, can be any type of document.
Create Pdf/A Create a archive conform PDF/A including xmp Metadata.
Stamp Stamp your document with text or images.

How to add our plugin to your project

Use your favourite build tools to build your project. The depenency information for the various building tools can be found here.

Getting Started

To get started get a Token by dropping us an email or registering in our portal.

The Token is required for Basic Authentication. The Pdf4me Client Api provides you already with the necessary implementation. You need only to get an instance for the Pdf4meClient as shown in the sample below.

// Either you store them in the config.properties file with keys clientId and secret
// Do not use any quotes:
// Correct: clientId=sample-not-working-key-aaaaaaa
// Incorrect: clientId="sample-not-working-key-aaaaaaa"
Pdf4meClient pdf4meClient = new Pdf4meClient();

// or you pass them as arguments when constructing the Pdf4meClient object
Pdf4meClient pdf4meClient = new Pdf4meClient(clientId, secret);

// The pdf4meClient object delivers the necessary authentication when instantiating the different pdf4meClients such as for instance Merge
MergeClient mergeClient = new MergeClient(pdf4meClient);
byte[] file1 = Files.readAllBytes(Paths.get("myFirstPdf.pdf"));
byte[] file2 = Files.readAllBytes(Paths.get("mySecondPdf.pdf"));
byte[] mergedPdf = mergeClient.merge2Pdfs(file1, file2);

Documentation

Please visit our documentation for more information about all the functionalities provided and on how to use pdf4me.

Recommendation

It's recommended to create an instance of Pdf4meClient per thread in a multithreaded environment to avoid any potential issues.

Contribution

Contributions are very welcome. Please have a look at the instructions below for a smooth project setup.

  1. Fork pdf4me
  2. Clone your copy of pdf4me
  3. Start your IDE, e.g., Eclipse
  4. Import the two projects: In Eclipse: click on File in the menu -> Import... -> Choose the Maven folder -> Existing Maven Projects
  • import Pdf4meJavaClientApi
  • import Pdf4meJavaClientApiTest
  1. You are ready to go

Running the Test Cases

In order for the test cases to run, a config.properties file containing the clientId and secret must be stored in the Pdf4meJavaClientApiTest folder. Please drop us an email (support-dev@pdf4me.com), so we can provide you the developer (clientId, secret) pair for testing the code of your pull request. The test cases are found in Pdf4meJavaClientApiTest/src/test/java/jUnit.

PDF4me Consumer

Those who are looking for PDF4me online tool can find it at PDF4me.com