Imagine this situation, you are using Linux and want to read or print Microsoft Word document (doc or docx), you might encounter some difficulties when working with such documents. You have no Microsoft Office installed and the alternative Office Suite (LibreOffice or OpenOffice) doesn't open the document properly (lost format, font, etc). If you have an Internet access, you can solve this problem easily! Today I'd like to share the trick to convert Microsoft Word document into PDF without any additional software, just use Linux Terminal and an Internet access.
Please open ".bashrc" file with your favorite text editor, and add the following code at the end of the file:
Save the change you've made. To convert Microsoft Word document, simply open a new Terminal window and type the following command:
- doc2pdf () {
- curl -# -F inputDocument=@"$1" http://www.doc2pdf.net/convert/document.pdf > "${1%.*}.pdf"
- }
Or if you want to convert Microsoft Office 2007 or later document, run the following command:
- doc2pdf file_name.doc
Wait, what just happened? Simple, it sends Microsoft Word document to www.doc2pdf.net and download the converted PDF file automatically!
- doc2pdf file_name.docx
Demo video:
Regards :)