This week The apache Ignite book becomes one of the top books of leanpub

This week The apache Ignite book becomes one of the top books of leanpub.


JODReports is alive

Yesterday we got a requirement from our consumer to convert MS office document to Html as like a google feature "View as html" on portal. As always it was very urgent and with high priority task on Jira. At first i have tried to solve it on regular way but found that there is no straight forword way on java to manage the task. A few commercial product has available on the web to solve the task. One of them are Davisor, 1 cpu license is about 2400 euro. Another one is Aspose. Download their trail version and first of all i discover that Aspose has not support convert Pdf to Html. Davisor convert MS office document not very well, nested table couldn't convert to html at all.
After a few googling i have found some information to use Open Office Org (ooo) to convert MS office documents to any format including PDF, html e.t.c. Also found a few fragment of code and API documents of OOO and JODConvertor open source to convert MS office documents. With great surprise i found that JOdConverter implements OOO api and it's out of box api to convert documents.
JODconverter library provides:
1) CLI to convert documents from command line
2) High level Java api
3) Web service to convert documents
4) Maven 2 plugin
JodReports even provides very well documented user guide to quick start. All you have to need is to start Open office application as and service and you are ready to go.
For starting OOO follow the command
ip-95-221-157-44:~ samim$ /Applications/ -accept="socket,host=localhost,port=8100;urp;" -nologo -headless

Now you are ready to make some experiment with MS office documents,
OpenOfficeConnection conn = new SocketOpenOfficeConnection(8100);
try {
DocumentConverter converter = new OpenOfficeDocumentConverter(conn);
converter.convert(new File("/Users/samim/Downloads/big.doc"), new File("/Users/samim/Downloads/big.html"));
} catch (ConnectException e) {
} finally {

You could also customize your export options whenever convert to PDF documents. JOdConverter save my a lot of time and solve my task and satisfy our customer. Many thank't to the developers of the library.


satyam said...

can u plz guide me how to connect remote server in which OpenOffice installed and already running the services ...and by that service we can converting doc to pdf using that remote server....?

Plz help in this regards

Shamim Ahmed said...

Hi satyam,
I was far way from blog and couldn't able to make response. If you already havn't figure out how to connect to OOO remote server, do the following
1) Use JodConverter highlevel api to connect to remote ooo server. First make sure that server is up and running.
This following fragment code will connect to remote OOO with port 8100
OpenOfficeConnection conn = new SocketOpenOfficeConnection(8100);
Wish you to good luck