Here’s how to convert Microsoft Office *.docx files to PDF using Linux in Command Line.
This trick can also be used together with other documents files supported by LibreOffice
First make sure you’ve installed the latest version of LibreOffice for use in command line environment.
Assuming the user is ‘example’ and the filename to convert is ‘doc.pdf’.
libreoffice --headless -convert-to pdf --outdir /home/example/ /home/example/doc.docx
The conversion can also be adapted to PHP or Python using their respective shell_exec or subprocess directive.
Sometimes you might have no choice except to open Microsoft Office 2007 (*.docx) files that you’ve just received in your email. The problem is, you do not have any other application that support Office 2007 format.
Here’s an easy way to (kinda) solve that problem, you can convert Microsoft Office 2007 files online, using Google Docs.
The steps are easy, you need to login into your Google Docs account, then upload the Office 2007 files. After that, you can choose the “Download file as” option to convert the file to your favorite document format (typically OpenDocument or older *.doc Microsoft Office word document).
Bear in mind that the conversion is not 100% perfect and there will be parts of document that won’t look exactly as the original ones.
This guide might be a little different from the others because I write this for the Windows users. Here’s how to convert Microsoft OpenXML docx files to odf OpenDocument files (and vice versa) in Windows using only commandline :
Odfconverter also supports converting Open Document files (ODF, ODP, ODT) to OpenXML files (PPTX,DOCX,XLSX) making it a handy tool to use.
Odfconverter is a (relatively) small and compact standalone tool for converting Office 2007 files to their OpenDocument counterpart. The convenient batch mode conversion makes it attractive tool to use when converting multiple files between the two formats.
The only downside with this converter is that it does not convert mathematical formula pretty well compared to other features.