I have an application need to print a MS Word .docx file from the command line. The background is this is on Snow Leopard Server with CUPS-PDF as the default printer. If in the finder I click once on the .docx file to select and then select print from the file menu it opens MS Word (2011 is installed) and prints the file to the spool (via CUPS) in PDF format. Perfect! Now what is the BASH command equivalent of that???
I have tried lpr, which only appears to work with straight text files. I have tried OPEN which OPENS MS Word but I see no “print” option for open. I have tried the usual MS Office equivalent (OpenOffice and LibreOffice) which both work but the generated PDF layout is so far from that generated by Word that it is shamefully unacceptable. I tried using osascript = AppleScript = which works but is spotty – it does not always trigger.
My challenge is I am creating the .docx outside of word from a template with a PHP program and just need to convert it to PDF retaining all formatting.
Take a look at
launch, available here: http://sabi.net/nriley/software/, also easy to install using homebrew or macports.It is like
open, but adds some extra features, including