K
kaf
Hi,
I have a requirement where I have to print any given file to a specific
printer. My application then consumes the output of this printer. I also
need to do this without any user intervention and without any GUI. I have
managed to get the printing done using Shell Execute, however, it always
shows the associated application even though I have specified
ProcessWindowStyle.Hidden as window style. My code snippets are given below:
<CODE>
Process objProcess = new Process();
objProcess.StartInfo.FileName = fileName; //file to print
objProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden |
ProcessWindowStyle.Minimized;
objProcess.StartInfo.UseShellExecute = true;
objProcess.StartInfo.CreateNoWindow = false;
objProcess.StartInfo.ErrorDialog = false;
objProcess.StartInfo.Verb = "print";
objProcess.Start();
</CODE>
I have searched all over but no solutions so far. I also think that this
should be possible as Microsoft Fax service does exactly this using it's fax
printer.
Any pointers will be appreciated.
Thanks,
I have a requirement where I have to print any given file to a specific
printer. My application then consumes the output of this printer. I also
need to do this without any user intervention and without any GUI. I have
managed to get the printing done using Shell Execute, however, it always
shows the associated application even though I have specified
ProcessWindowStyle.Hidden as window style. My code snippets are given below:
<CODE>
Process objProcess = new Process();
objProcess.StartInfo.FileName = fileName; //file to print
objProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden |
ProcessWindowStyle.Minimized;
objProcess.StartInfo.UseShellExecute = true;
objProcess.StartInfo.CreateNoWindow = false;
objProcess.StartInfo.ErrorDialog = false;
objProcess.StartInfo.Verb = "print";
objProcess.Start();
</CODE>
I have searched all over but no solutions so far. I also think that this
should be possible as Microsoft Fax service does exactly this using it's fax
printer.
Any pointers will be appreciated.
Thanks,