Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I print a file from the command line?

Is there a way to run a file through a print driver without opening the application?

Ex: run a .docx file, without opening word, and save it to file?

like image 744
robblot Avatar asked May 01 '10 06:05

robblot


People also ask

How do I print the contents of a file in Terminal?

To print a file from your terminal, use the lpr command.

Which command is used to print a file print?

The print command is used to print a file directly without using a Windows application that supports printing.

How do I print from command prompt on a PC?

However, you can use the keyboard shortcut key Ctrl + P to open the print window on a PC or Command + P to open the print window on an Apple computer.


1 Answers

Since it is a .docx-file Microsoft Word is probably the best program to do the task.

I would have a look at the [command line arguments] to Word:

Have a look at the following switches:

/q, /n, /mFilePrintDefault and /mFileExit

(/q and /n explained in the page above, and /mXxxx refers to macros. Have a look att google.)

Example:

WINWORD.EXE your_document.docx /mFilePrintDefault /mFileExit /q /n

The following page seems to explain how to convert it to PDF.

like image 88
aioobe Avatar answered Nov 12 '22 14:11

aioobe