LPR via C#?

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
 
I

Ignacio Machin \( .NET/ C# MVP \)

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,
 
C

Chad Z. Hower aka Kudzu

=?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/
 
G

Guest

Sorry, I'm not sure I understand what you are saying. Could you please
explain alittle.

THANKS!!
 
G

Guest

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.
 
C

Chad Z. Hower aka Kudzu

=?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/
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top