In Ubuntu terminal libreoffice --headless --convert-to pdf test.docx I convert document file to pdf file is work fine.
*My doubt is in windows system without install libreoffice to need to convert docuemnt to pdf (i.e) without install libreoffice software only libreoffice exe or bat file convert word to pdf is possible? *Or In java code to execute command prompt to using microsoft office to convert word to pdf is possible?
You can try with Libreoffice portable with the cli :
LibreOfficePortable.exe -headless -convert-to pdf untitled.odt
I haven't tested it, please let me know if it works on your machine.
来源:https://stackoverflow.com/questions/36335881/libreoffice-exe-file-to-convert-word-to-pdf-in-windows