0

Possible Duplicate:
.NET: How to print files w/o opening them

I want to print my files discreetly without opening them I've been told to do this :

ProcessStartInfo psi = new ProcessStartInfo(documentFileName);
psi.Verb = "Print";
Process.Start(psi);

but ProcessStartInfo open the given file so how can I do my printing silently ???

Community
  • 1
  • 1
Joy
  • 1,707
  • 7
  • 29
  • 44
  • 2
    http://stackoverflow.com/questions/1018137/net-how-to-print-files-w-o-opening-them may be useful. – dash Oct 17 '12 at 14:13
  • @Slaks I should be applying this to any kind of file – Joy Oct 17 '12 at 14:20
  • so if I'm not conerned with the extension of 'documentFileName' (well in the matter of fact I'm handeling a list of files and I need to print them whatever their type was) what other alternative I should be doing instead of sending them to ProcessStartInfo ?? – Joy Oct 17 '12 at 14:35

2 Answers2

0

Try this:

psi.WindowStyle = ProcessWindowStyle.Hidden;
giacomelli
  • 7,287
  • 2
  • 27
  • 31
  • no Hidden mode is not the same as a silent mode, Hidden mode will open the file but won't show it which I'm avoiding to do ! – Joy Oct 17 '12 at 14:19
0

try using PrintDocument Class check the link below

http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument%28VS.80%29.aspx