Did you know that you can convert documents with a headless version of OpenOffice or LibreOffice? If you pass a few commands to the soffice
binary, you can convert one document type to another.
My examples will include paths for LibreOffice on a Mac, so make sure to adjust accordingly.
The following will convert all Word documents on my desktop to PDFs in the convert
folder on my Desktop:
HOME=/tmp TMPDIR=/tmp /Applications/LibreOffice.app/Contents/MacOS/soffice --headless --convert-to pdf:writer_pdf_Export --outdir /Users/jon/Desktop/output/ /Users/jon/Desktop/*.doc
Make sure to include HOME=/tmp TMPDIR=/tmp
before the command or it will run into permission issues and be unable to complete the file conversion.
Some believe writing files to the /tmp
directory is a better approach, but I didn’t end up trying it myself.
Thanks to: https://ask.libreoffice.org/en/question/2641/convert-to-command-line-parameter/