tags:

views:

58

answers:

2
+3  Q: 

Printing to a file

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

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

+1  A: 

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:

http://winhlp.com/WordCommandLineSwitches.htm

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

http://www.suodenjoki.dk/us/productions/articles/word2pdf.htm

aioobe
A: 

What you are looking for is called "headless start" of the program which needs to print. I know for sure that OpenOffice can do this. Basically, you need to start it and invoke a macro which will do the printing. Even more, you can print to a PDF, HTML, or anything else that Oo supports.

This negates the need for install of Microsoft Word and the cost of license, because OpenOffice is free.

Vanco