Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Process.Start to print documents without showing Word

I am using the following code to print a word document from a C# app.

            ProcessStartInfo info = new ProcessStartInfo(myDocumentsPath);
            info.Verb = "Print";
            info.CreateNoWindow = true;
            info.WindowStyle = ProcessWindowStyle.Hidden;
            Process.Start(info);

This works fine Word opens and prints the document, and then closes itself down. The issue is that Word opens visibly, despite CreateNoWindow = true, and WindowsStyle =Hidden. I would have expected these two settings to mean that Word opened silently.

EDIT: Please don't suggest Word object model automation - I have many different document types that need to be printed (PDF etc) - it is just Word docs that are causing the issue at the moment.

Any thoughts?

TIA

Matt

like image 251
Matt Avatar asked Apr 15 '09 10:04

Matt


1 Answers

Word is free to ignore (and apparently does ignore) your request that it remain hidden.

See also Why is my hidden process still visible?

like image 172
Ed Guiness Avatar answered Oct 21 '22 15:10

Ed Guiness