79164009

Date: 2024-11-06 19:34:08
Score: 2
Natty:
Report link

I was looking for an opensource Java solution to convert DOC/DOCX to PDF without loosing the design of the document.

I came to know about the usage of LibreOffice on Linux machine for the same in the following post. Thank you, Anmol.

https://stackoverflow.com/a/73711219/3085879

So, I gave a try installing LibreOffice on windows machine, and running the following command.

*C:\Users\ABCD\Desktop\sofficetest>"C:\Program Files\LibreOffice\program\soffice.exe" --convert-to pdf:writer_pdf_Export --outdir "C:\Users\ABCD\Desktop\sofficetest\output" .docx

Please note that I have used double quotes for paths to avoid space related issues. It works like a charm. :)

I found the syntax of the command when I ran the following command on the command prompt.

C:\Users\ABCD\Desktop\sofficetest>"C:\Program Files\LibreOffice\program\soffice.exe" --help

Please refer the highlighted section in the command run result screenshot.

enter image description here

The environment and software details are as follows.

Reasons:
  • Blacklisted phrase (0.5): Thank you
  • Blacklisted phrase (1): stackoverflow
  • Long answer (-1):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Rama Krishna Hati