Skip to content

Latest commit

 

History

History
 
 

Java

Java Sample Code

Details about using the Muhimbi PDF Converter Services from Java can be found below. Further information, including the object model, can be found in the Developer Guide and in the Muhimbi Knowledge Base.

Any questions? Drop us a line, we love to help.


Table of Contents


Prerequisites

Using the PDF Converter in combination with Java requires JDK 7 or later. Exact deployment and configuration steps for the various platforms vary slightly.

❗ Please make sure that a copy of the Muhimbi PDF Converter Services (Download) is installed on at least one Windows Server in your environment. (Don't worry, it can be invoked from non-Windows platforms including Linux). :exclamation:


Linux

There are multiple options for compiling and executing Java code on Linux. The examples provided in this section have been tested with Ubuntu 18.0.4 and Java versions 7 to 11 using both OpenJDK and Oracle Java. For example, install the OpenJDK version of Java 8 as follows:

sudo apt install openjdk-8-jdk-headless

❗If you wish to use Java 11 then we recommend using Maven to build the project. The Java EE Modules (including javax.xml.ws) have been removed from the standard Java SDK as of version 11. Scripts for compiling and running with Maven are supplied along the pom.xml file.:exclamation:

sudo apt install maven

Windows

For Windows developers we recommend using Oracle's official JDK. The examples provided in this section have been tested on Windows with this JDK.


Sample Code

Sample code, and related files, for the various facilities provided by the service can be found below. It is recommended to copy all samples to your local system using one of the following options:

  • Git: Use the following command to clone the entire repository to your system. This will download all files associated with this repository, and is most likely overkill, but it is the only easy way to download files using Git. Once downloaded, you can find the examples under the Java folder.

    git clone https://github.com/Muhimbi/PDF-Converter-Services/

  • SVN: A common trick to download only part of a Git repository is to use svn. Download only the Java client and sample code using the following command.

    svn export https://github.com/Muhimbi/PDF-Converter-Services/trunk/Java

  • ZIP: Download a ZIP archive of the entire repository. Once downloaded, you can find the examples under the Java folder.


A full overview can be found below.

Sample Description
Convert and Merge Combine multiple files, and URLs, into a single PDF (Based on Java wsimport).
Convert and Secure Convert a document into PDF and apply security settings, passwords and restrictions to the PDF. (Based on Java wsimport)
Convert and Watermark Convert a document into PDF and apply watermarks. (Based on Java wsimport)
Convert using Axis Convert a document into PDF using proxy classes generated by Apache Axis2
OCR PDF Use Optical Character Recognition to convert a fax, scan or other image into a text PDF.

Any questions? Drop our friendly support desk a line, we love to help.