I am trying to convert doc to pdf using Apache POI, but the resulting pdf document contains only text, it is not having any formating like images, tables alignment etc.
I used OpenOffice/LibreOffice for exporting to PDF, it has some automation-support, i.e. something like
unoconv -vvv --timeout=10 --doctype=document --output=result.pdf result.docx
will convert the doc to pdf.