Search code examples
javams-wordapache-poiitextdoc

Which are the best Java API for convert docx to pdf


I need an API java for convert a docx to pdf, I tested with XDocReport but I believe this doesn't convert the image of the head of the document.I need convert table,image and border in the pdf,the api can be paid or free. Thanks in advance.


Solution

  • Few years ago I have successfully used JODConverter with Open Office running in the headless mode to convert all sorts of files.

    To be honest I cannot remember the exact limitations of the software, but there is a version of what I did still running as a webservice here:

    http://oxgarage.oucs.ox.ac.uk:8080/ege-webclient/

    and here: http://www.tei-c.org/oxgarage/.

    No idea about what is the current version of the converter they are using and it is possible that it is a bit outdated and at the moment it works a lot better, but you can try to convert your files and see how well they come up before you go head first into coding.

    I also found this article and it looks like it might be quite helpful for you, have a look at it:

    http://angelozerr.wordpress.com/2012/12/06/how-to-convert-docxodt-to-pdfhtml-with-java/.

    Oh and by the way, that webservice is opensource:

    https://github.com/sebastianrahtz/oxgarage , so you can have a look at how it is implemented as well.