JACOB is a free Java COM bridge that allows easyConverter SDK to be used from Java.
The entire easyConverter SDK is located under the com.bcl.easyConverter namespace, which is further divided into the following parts:
It is essential that easyConverter gets initialized before any of the SDK functions are called. Please use the following line of code to initialize easyConverter:
It is good practice to uninitialize the easyConverter SDK before your application quits:
Note that all exceptions thrown by easyConverter SDK are of type EasyConverterException.
We tried to make the Java API as close to the native COM API as possible. As a result, the Java class, enumeration and function names are all identical to the COM API names. That means the following:
We tried to make the Java API strongly typed whenever it was possible. That means an integer parameter is of type int, a string parameter is of type String, and so on. However, since COM itself is not always strongly typed, the easyConverter Java API contains some loosely typed parameters.
You can simply pass a value, and it gets implicitly converted into Object. For example, Password is an optional parameter in IPDF2HTML.getNumberOfPages:
Simply pass null to use the default value for an optional parameter.
A stream is an array of bytes with a type of byte. It gets implicitly converted into Object when passed into a function that accepts a stream. Example:
File inputFile = new File("c:\\input.pdf"); FileInputStream inputFileStream = new FileInputStream(inputFile.getCanonicalPath()); byte inputStream = new byte[(int)inputFile.length()]; inputFileStream.read(inputStream); SafeArray output = pdf2html.ConvertToHTML3(inputStream, null, null, null).toSafeArray();
Variant is a JACOB-specific class designed as a wrapper around COM Variants. The Variant can be converted into SafeArray by calling .toSafeArray() on it. Example:
SafeArray output = pdf2html.ConvertToHTML3(inputStream, null, null, null).toSafeArray();
ConvertToHTML3 does not simply return a single stream, but an array of streams, one stream for the HTML, and one for each individual image. Please see the documentation of ConvertToHTML3 for a detailed explanation and a complete sample code.
Note that the Variant and SafeArray classes are in the com.jacob.com namespace.