LPR via C#?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am working on an application which sends a print file to a print queue on a
sun machine. Currently this is run vit DTS and a batch file calls the LPR
command.

I am changing this app to a .net console app in C#. I was wondering if it
is possible to do call the LPR command w/o shelling out or using a batch file?

Thanks in advance,
SPO
 
hi,

you could use the Process class :

ProcessStartInfo si = new ProcessStartInfo();
si.FileName =
System.Configuration.ConfigurationSettings.AppSettings["path_to_exe"] ;
si.WindowStyle = ProcessWindowStyle.Hidden;
theRunningProcess = Process.Start( si );


cheers,
 
=?Utf-8?B?aWFtc3Bv?= said:
I am changing this app to a .net console app in C#. I was wondering
if it is possible to do call the LPR command w/o shelling out or using
a batch file?

Do you really wat to call the LPR command directly? Why not just connect using the LPR
protocol directly?


--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Empower ASP.NET with IntraWeb
http://www.atozed.com/IntraWeb/
 
Sorry, I'm not sure I understand what you are saying. Could you please
explain alittle.

THANKS!!
 
what is currently called via a batch file is:
LPR -S <ip> -P <queue> <fileName>

I need to find a better way then that in order to catch error codes etc.
 
=?Utf-8?B?aWFtc3Bv?= said:
Sorry, I'm not sure I understand what you are saying. Could you
please explain alittle.

The LPR executable just calls the LPR protocol. You are using an unnecessary step. Why not just
use the LPR protocol directly. Its very simple, there are even free components to do it:

http://www.indyproject.org/features.iwp


--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Get your ASP.NET in gear with IntraWeb!
http://www.atozed.com/IntraWeb/
 
if i were to use this. Would i be able to catch a return code if the LPR app
has a error?

Ignacio Machin ( .NET/ C# MVP ) said:
hi,

you could use the Process class :

ProcessStartInfo si = new ProcessStartInfo();
si.FileName =
System.Configuration.ConfigurationSettings.AppSettings["path_to_exe"] ;
si.WindowStyle = ProcessWindowStyle.Hidden;
theRunningProcess = Process.Start( si );


cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation



iamspo said:
I am working on an application which sends a print file to a print queue on
a
sun machine. Currently this is run vit DTS and a batch file calls the LPR
command.

I am changing this app to a .net console app in C#. I was wondering if it
is possible to do call the LPR command w/o shelling out or using a batch
file?

Thanks in advance,
SPO
 
Back
Top