How to print label on network shared printer in ASP.Net
How to print label on network shared printer in ASP.Net
am 09.03.2006 19:17:28 von peng
Hi,
I am development a project using C#.Net. Inside application, it needs to
print labels on different Zebra label printers on the network. I used a shell
script, but it only worked on the server machine locally. Anybody knows how
to do it?
Thanks,
Peng
RE: How to print label on network shared printer in ASP.Net
am 09.03.2006 21:20:31 von Paul Aspinall
Hi
I've just done exactly this.....
I went down a few dead ends before getting there....
I initially formatted my Zebra label in ZPL in a txt file, and used a CMD
line TYPE label.txt > \\computername\printershare
The label printed fine. However, I then started to code this using interop
making calls to the Win32 API to direct print.
The prints did not happen, and I was baffled. I wasn't sure why it wasn't
printing, so I then had my code shell out to a CMD line, and run the same
TYPE redirect to the printer.
This didn't work!! It worked from my own command line, but not when the code
shelled it....
Its a permission problem. The ASPNET account doesn't have permissions to the
printer in a corporate network environment.
To get round this I added the following line to web.config
This makes the requests on the server run in the security context of the web
requestor (ie. a valid user, and not the ASPNET account)
I expected this to work..... but it did not..... :-((
The problem was that I was still shelling out to execute the TYPE, and when
you do this, the account runs under ASPNET again!!!
I re-instated my direct print code in windows, and it worked straight away!!!
To summise:
- add to your web.config file
- make an interop call back to the Win32 API to execute direct printing to a
printer share.
I have some sample code if you would like it.
Good luck.. HTH
Paul
MCSD, MCDBA
"peng" wrote:
> Hi,
>
> I am development a project using C#.Net. Inside application, it needs to
> print labels on different Zebra label printers on the network. I used a shell
> script, but it only worked on the server machine locally. Anybody knows how
> to do it?
>
> Thanks,
> Peng
RE: How to print label on network shared printer in ASP.Net
am 10.03.2006 21:00:20 von peng
Paul provided me with the sample code and I applied it to my application. It
worked beautifully!! Thanks a lot, Paul!
Peng
"Paul Aspinall" wrote:
> Hi
> I've just done exactly this.....
> I went down a few dead ends before getting there....
>
> I initially formatted my Zebra label in ZPL in a txt file, and used a CMD
> line TYPE label.txt > \\computername\printershare
>
> The label printed fine. However, I then started to code this using interop
> making calls to the Win32 API to direct print.
>
> The prints did not happen, and I was baffled. I wasn't sure why it wasn't
> printing, so I then had my code shell out to a CMD line, and run the same
> TYPE redirect to the printer.
> This didn't work!! It worked from my own command line, but not when the code
> shelled it....
>
> Its a permission problem. The ASPNET account doesn't have permissions to the
> printer in a corporate network environment.
> To get round this I added the following line to web.config
>
>
> This makes the requests on the server run in the security context of the web
> requestor (ie. a valid user, and not the ASPNET account)
>
> I expected this to work..... but it did not..... :-((
>
> The problem was that I was still shelling out to execute the TYPE, and when
> you do this, the account runs under ASPNET again!!!
> I re-instated my direct print code in windows, and it worked straight away!!!
>
> To summise:
> - add to your web.config file
> - make an interop call back to the Win32 API to execute direct printing to a
> printer share.
>
> I have some sample code if you would like it.
>
> Good luck.. HTH
>
>
> Paul
> MCSD, MCDBA
>
>
> "peng" wrote:
>
> > Hi,
> >
> > I am development a project using C#.Net. Inside application, it needs to
> > print labels on different Zebra label printers on the network. I used a shell
> > script, but it only worked on the server machine locally. Anybody knows how
> > to do it?
> >
> > Thanks,
> > Peng
RE: How to print label on network shared printer in ASP.Net
am 14.04.2006 00:56:02 von KAYIHAN ONUK
Hi Paul,
May I have your code please? I didn't understand what you mean with "make an
interop call back to the Win32 API to execute direct printing to a printer
share"
I'm experiencing the same problem when trying to print to a shared printer
from an ASP.net application. impersonate=true doesn't help alone... Thanks in
advance. I need your solution immediately...
Yours sincerely,
Kayıhan Onuk
"Paul Aspinall" wrote:
> Hi
> I've just done exactly this.....
> I went down a few dead ends before getting there....
>
> I initially formatted my Zebra label in ZPL in a txt file, and used a CMD
> line TYPE label.txt > \\computername\printershare
>
> The label printed fine. However, I then started to code this using interop
> making calls to the Win32 API to direct print.
>
> The prints did not happen, and I was baffled. I wasn't sure why it wasn't
> printing, so I then had my code shell out to a CMD line, and run the same
> TYPE redirect to the printer.
> This didn't work!! It worked from my own command line, but not when the code
> shelled it....
>
> Its a permission problem. The ASPNET account doesn't have permissions to the
> printer in a corporate network environment.
> To get round this I added the following line to web.config
>
>
> This makes the requests on the server run in the security context of the web
> requestor (ie. a valid user, and not the ASPNET account)
>
> I expected this to work..... but it did not..... :-((
>
> The problem was that I was still shelling out to execute the TYPE, and when
> you do this, the account runs under ASPNET again!!!
> I re-instated my direct print code in windows, and it worked straight away!!!
>
> To summise:
> - add to your web.config file
> - make an interop call back to the Win32 API to execute direct printing to a
> printer share.
>
> I have some sample code if you would like it.
>
> Good luck.. HTH
>
>
> Paul
> MCSD, MCDBA
>
>
> "peng" wrote:
>
> > Hi,
> >
> > I am development a project using C#.Net. Inside application, it needs to
> > print labels on different Zebra label printers on the network. I used a shell
> > script, but it only worked on the server machine locally. Anybody knows how
> > to do it?
> >
> > Thanks,
> > Peng
Re: How to print label on network shared printer in ASP.Net
am 21.04.2006 08:27:53 von gurumoorthy
Hi Paul and Peng,
This Guru,I am development a project using VB.Net. Inside application,
it needs to
print labels on different Zebra label printers on the network. I used a
shell
script, but it only worked on the server machine locally.
May any one give your code please? I didn't understand what you mean
with "make an
interop call back to the Win32 API to execute direct printing to a
printer
share"
I'm experiencing the same problem when trying to print to a shared
printer
from an ASP.net application. impersonate=true doesn't help alone...
Thanks in
advance. I need your solution immediately... my mail id is
guru.net@rediffmail.com
Yours sincerely,
guru
KAYIHAN ONUK Wrote:
> Hi Paul,
>
> May I have your code please? I didn't understand what you mean with
> "make an
> interop call back to the Win32 API to execute direct printing to a
> printer
> share"
>
> I'm experiencing the same problem when trying to print to a shared
> printer
> from an ASP.net application. impersonate=true doesn't help alone...
> Thanks in
> advance. I need your solution immediately...
>
> Yours sincerely,
>
> Kayıhan Onuk
>
> "Paul Aspinall" wrote:
--
gurumoorthy
------------------------------------------------------------ ------------
gurumoorthy's Profile: http://www.hightechtalks.com/m327
View this thread: http://www.hightechtalks.com/t348274
Re: How to print label on network shared printer in ASP.Net
am 22.05.2006 11:21:42 von kain
Paul, could you send me one copy of that sample code? I just began to
learn C#, but my boss want me to write zpl program......I searched for
long time, and still no idea with this issue......So , could you give
me a hand?
--
Kain
------------------------------------------------------------ ------------
Posted via http://www.codecomments.com
------------------------------------------------------------ ------------
Re: How to print label on network shared printer in ASP.Net
am 25.05.2006 01:58:02 von ctwilliams
Hi Paul. Would you please send me a sample of your code? I would
really appreciate it.
--
ctwilliams
------------------------------------------------------------ ------------
Posted via http://www.codecomments.com
------------------------------------------------------------ ------------
Re: How to print label on network shared printer in ASP.Net
am 04.06.2006 07:32:29 von caro
Paul,
help me please,send me your code,i'm stuck on how to print label to
zebra printer form asp.net!
thank you
ctwilliams wrote:
> *Hi Paul. Would you please send me a sample of your code? I would
> really appreciate it. *
--
caro
------------------------------------------------------------ ------------
Posted via http://www.codecomments.com
------------------------------------------------------------ ------------
Re: How to print label on network shared printer in ASP.Net
am 11.06.2006 16:28:45 von lhueekar
Hi Paul,
Could you please provide me the code? I am facing this kind of problem
in my ASP.net application.
Regards,
Christie
--
lhueekar
------------------------------------------------------------ ------------
Posted via http://www.codecomments.com
------------------------------------------------------------ ------------
Re: How to print label on network shared printer in ASP.Net
am 23.06.2006 14:34:33 von rzey
Hi Paul,
Would you please send me a sample of your code? I would really
appreciate it.
Thanks,
Robert Z.
MCSD
--
rzey
------------------------------------------------------------ ------------
Posted via http://www.codecomments.com
------------------------------------------------------------ ------------
Re: How to print label on network shared printer in ASP.Net
am 25.06.2006 14:27:51 von khtee
Hi Paul,
Could you also send me a sample of your code please? I would really
appreciate it.
--
khtee
------------------------------------------------------------ ------------
Posted via http://www.codecomments.com
------------------------------------------------------------ ------------
RE: How to print label on network shared printer in ASP.Net
am 10.07.2006 17:54:30 von Greg
Paul,
Please send me the sample code as well.
Thanks.
Greg
*** Sent via Developersdex http://www.developersdex.com ***
RE: How to print label on network shared printer in ASP.Net
am 19.07.2006 00:23:55 von Hoang Nguyen
Hello Peng,
Do you still have the sample code? Can you please send me the sample
code.
Thanks,
Hoang-
*** Sent via Developersdex http://www.developersdex.com ***
RE: How to print label on network shared printer in ASP.Net
am 19.07.2006 00:24:11 von Hoang Nguyen
Hello Paul,
Can you please send me the sample code.
Thanks.
Hoang-
*** Sent via Developersdex http://www.developersdex.com ***
RE: How to print label on network shared printer in ASP.Net
am 31.07.2006 18:46:16 von wendy zhu
Hi Paul,
I have the same issue. Could you send me a sample of your code please? I
would really appreciate it.
Thanks in advance,
Wendy
*** Sent via Developersdex http://www.developersdex.com ***
RE: How to print label on network shared printer in ASP.Net
am 11.08.2006 00:47:02 von Edison Garcia
Hi Paul. Would you please send me a sample of your code? I would really
appreciate it.
Egarcia
*** Sent via Developersdex http://www.developersdex.com ***
RE: How to print label on network shared printer in ASP.Net
am 16.08.2006 09:27:07 von m3ckon
Hi Paul,
I am using .net to fire a print to zebra printer.The label is simple
one, no bar codes involved, so i just created string with new line
characters '\r\n' after every field. the output format is correct on
local network laserjet printer.But when i replace this printer path with
that os zebra printer, unable to get the output, rather a blank print
label.I am using the code recommended by msdn
http://support.microsoft.com/?kbid=322091.Can u please share your code
and advice me on this issue.
Thanks
Nitin
*** Sent via Developersdex http://www.developersdex.com ***
RE: How to print label on network shared printer in ASP.Net
am 16.08.2006 09:30:16 von m3ckon
Hi Paul,
I am using .net to fire a print to zebra printer.The label is simple
one, no bar codes involved, so i just created string with new line
characters '\r\n' after every field. the output format is correct on
local network laserjet printer.But when i replace this printer path with
that os zebra printer, unable to get the output, rather a blank print
label.I am using the code recommended by msdn
http://support.microsoft.com/?kbid=322091.can u please send your code
and advice me on this issue.
Thanks
Nitin
*** Sent via Developersdex http://www.developersdex.com ***
RE: How to print label on network shared printer in ASP.Net
am 17.08.2006 14:19:04 von Christophe Crausaz
Hi Paul,
I am also facing the same problem.... May I ask you to also send me you
your code sample.
Thanks a lot in advance
Christophe
*** Sent via Developersdex http://www.developersdex.com ***
RE: How to print label on network shared printer in ASP.Net
am 23.08.2006 11:21:05 von Julien Gontier
Could you please send me your code, I would really appreciate.
Thanks
*** Sent via Developersdex http://www.developersdex.com ***
Re: How to print label on network shared printer in ASP.Net
am 13.11.2006 12:38:05 von jeremy Lee
Hi Paul,
Would aapreciate it if you can send the the sample code too. I am stuck
here for weeks, urgently need it by this week.
Thanks.
Jeremy
*** Sent via Developersdex http://www.developersdex.com ***
Re: How to print label on network shared printer in ASP.Net
am 26.01.2007 09:44:10 von newbee
Hi Paul,
I am new to ASP.NET and ZPL stuff... Could you be kind enough to show me
some sample codes on how to communicate between ASP.NET with the Zebra
Printer? I am communicating to a 140Xilll printer.
Thank you. I greatly appreciate your help.
Newbie
*** Sent via Developersdex http://www.developersdex.com ***
Re: How to print label on network shared printer in ASP.Net
am 26.01.2007 15:24:34 von George Ter-Saakov
Fairly easy.
First you need to add Zebra printer under account ASP.NET is using to be
able to print.
check out this article
http://support.microsoft.com/kb/184291/en-us
And this
http://support.microsoft.com/kb/324565/en-us
then in case of Zebra Printer you have 2 choices. You can print label as an
image (which is pretty slow) Or you can print label using ZPL II language
( this is the preferred method).
To print a label with ZPL II language you need to send RAW data to printer.
check out this article
http://support.microsoft.com/kb/322091
I recently had to do same thing (not from ASP.NET though).
PS: If you are printing labels for FedEx look out for ^MD30 command in their
ZPL II string for label. For whatever reason they put that in and that
command bumps up the darkness to the top what in case burns out the head on
thermal printer like yours. And those heads are expensive - about $300
I end up with the code like this
int iIndex = _sLabel.IndexOf("^MD");
if (iIndex != -1)
_sLabel = _sLabel.Substring(0, iIndex) + "^MD00" + _sLabel.Substring(iIndex
+ 5);
RawPrinterHelper.SendStringToPrinter("ZebISQ", _sLabel);
George.
wrote in message news:eO03mYSQHHA.996@TK2MSFTNGP02.phx.gbl...
> Hi Paul,
>
> I am new to ASP.NET and ZPL stuff... Could you be kind enough to show me
> some sample codes on how to communicate between ASP.NET with the Zebra
> Printer? I am communicating to a 140Xilll printer.
>
> Thank you. I greatly appreciate your help.
>
> Newbie
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
RE: How to print label on network shared printer in ASP.Net
am 26.01.2007 17:15:15 von Peter Eggleston
Hi Paul!
My boss just told me to do a project to print label, but I am not
sure I can do it. Would you please send me a sample of your code? I
would really appreciate it.
Peter.
*** Sent via Developersdex http://www.developersdex.com ***
RE: How to print label on network shared printer in ASP.Net
am 10.02.2007 18:11:08 von s martin
Please send me the code you have for this sample. Thanks in advance.
*** Sent via Developersdex http://www.developersdex.com ***
RE: How to print label on network shared printer in ASP.Net
am 28.02.2007 07:54:07 von Paresh
Dear Paul
Could you please send me your code, I would really appreciate.
pareshmmodi@hotmail.com
Thanks
From http://www.developmentnow.com/g/8_2007_1_0_0_712654/How-to-p rint-label-on-network-shared-printer-in-ASP-Net.htm
Posted via DevelopmentNow.com Groups
http://www.developmentnow.com
RE: How to print label on network shared printer in ASP.Net
am 13.04.2007 23:56:10 von tom fuertes
Hey,
I am trying to print to my Zebra printer. Can you please forward me the
code.
Thank you,
-Tom
*** Sent via Developersdex http://www.developersdex.com ***
RE: How to print label on network shared printer in ASP.Net
am 20.04.2007 20:12:02 von Rick Veguilla
can you please send me this if you have the code, thanks:
Rick
*** Sent via Developersdex http://www.developersdex.com ***
RE: How to print label on network shared printer in ASP.Net
am 23.04.2007 20:26:56 von siv b
Hi Paul,
can u pls send barcode printg from asp.net saple.
Thanks
siva
*** Sent via Developersdex http://www.developersdex.com ***
RE: How to print label on network shared printer in ASP.Net
am 23.04.2007 20:41:52 von siv b
Hi Peng,
can u send sample code to me.
Thanks and Regards,
Siva
*** Sent via Developersdex http://www.developersdex.com ***
RE: How to print label on network shared printer in ASP.Net
am 12.06.2007 14:27:04 von adhi moolam
Hi Please send the sample code
Regards
Adhi.D
*** Sent via Developersdex http://www.developersdex.com ***
RE: How to print label on network shared printer in ASP.Net
am 15.06.2007 15:21:59 von Tommy Boy
Paul,
I see that his is an old thread. If possible could you forward your
print code?
Regards,
Tom
*** Sent via Developersdex http://www.developersdex.com ***
RE: How to print label on network shared printer in ASP.Net
am 26.06.2007 17:42:48 von Josh Tyson
Could you please send me the code? I am having problems setting the
permissions so that I can print to my Zebra Printer from a asp website.
josh@encoelectronics.com
*** Sent via Developersdex http://www.developersdex.com ***
RE: How to print label on network shared printer in ASP.Net
am 26.06.2007 20:25:45 von Ernie Redfern
Paul:
Could you please send me the code? We are working though some of the
same issues. ejredfern@ch.blommer.com
*** Sent via Developersdex http://www.developersdex.com ***
RE: How to print label on network shared printer in ASP.Net
am 04.07.2007 07:29:36 von Raj Durai
Hi Paul,
Can you please send me the code?
*** Sent via Developersdex http://www.developersdex.com ***
RE: How to print label on network shared printer in ASP.Net
am 23.07.2007 14:16:09 von Narahari Sanga
Paul,
Could you please send the sample code to perform printing?
Regards,
Narahari
*** Sent via Developersdex http://www.developersdex.com ***
RE: How to print label on network shared printer in ASP.Net
am 01.08.2007 09:03:04 von Raj Gopal Kommoju Sri Venkata
Hi Paul,
Can you please send me the sample code.
Thanks,
Raj Gopal.
*** Sent via Developersdex http://www.developersdex.com ***
RE: How to print label on network shared printer in ASP.Net
am 02.08.2007 21:08:46 von Hector B
Hello Paul,
Can you please send me the sample code.
Thanks.
HB
From http://www.developmentnow.com/g/8_2007_1_0_0_712654/How-to-p rint-label-on-network-shared-printer-in-ASP-Net.htm
Posted via DevelopmentNow.com Groups
http://www.developmentnow.com
RE: How to print label on network shared printer in ASP.Net
am 19.09.2007 15:35:18 von Joanna Bar
I've written an Inventory application and users would like labels
printed after they have added the items to the database. This is done
by filling out a form and then pressing submit. Upon submission I would
like to have a label printed.
I'm using a Zebra printer, connected to the users local machine, while
the application resides on a server and I use the barcodenet dll to
create the barcode to place on labels.
I have successfully been able to print labels as long as I'm in the
application on the server and the printer is located there, but this is
not the scenario that I need to implement. The printers will be located
far away from the server so I need to be able to send the print to the
local label printer.
Does anyone have any ideas how I can access the local printers from
within ASP.NET?
*** Sent via Developersdex http://www.developersdex.com ***
Re: How to print label on network shared printer in ASP.Net
am 19.09.2007 15:43:38 von mark
"Joanna Bar" wrote in message
news:%23l2OsHs%23HHA.1164@TK2MSFTNGP02.phx.gbl...
> I've written an Inventory application and users would like labels
> printed after they have added the items to the database. This is done
> by filling out a form and then pressing submit. Upon submission I would
> like to have a label printed.
>
> I'm using a Zebra printer, connected to the users local machine, while
> the application resides on a server and I use the barcodenet dll to
> create the barcode to place on labels.
>
> I have successfully been able to print labels as long as I'm in the
> application on the server and the printer is located there, but this is
> not the scenario that I need to implement. The printers will be located
> far away from the server so I need to be able to send the print to the
> local label printer.
>
> Does anyone have any ideas how I can access the local printers from
> within ASP.NET?
You can't natively... Modern browsers are designed specifically to prevent
any sort of direct interaction with the hardware or software in the machine
on which they are running, for fairly obvious security reasons...
Does each user absolutely have to have their own Zebra printer?
If not, I would advise you to set up a dedicated print machine with the
printer attached, and write a Windows service which polls your database
server for labels to print...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
RE: How to print label on network shared printer in ASP.Net
am 25.09.2007 23:00:54 von crys m
Would you send me your sample code?
Thanks!
*** Sent via Developersdex http://www.developersdex.com ***
RE: How to print label on network shared printer in ASP.Net
am 17.10.2007 23:28:43 von joseph miller
Hi Paul,
I'm doing the exact same thing. Was wondering if you would send me the
code also.
thanks
*** Sent via Developersdex http://www.developersdex.com ***
Re: How to print label on network shared printer in ASP.Net
am 14.11.2007 17:31:19 von Jenny Moore
If anyone there is still listening, can you please send me the code to
be able to do this !! I am desperate.
Thanks in advance.
Jenny
*** Sent via Developersdex http://www.developersdex.com ***
Re: How to print label on network shared printer in ASP.Net
am 07.12.2007 03:44:32 von cheebeng73
Hi Paul,
Can you send me your sample.
Thanks in advance.
Jimmy
--
cheebeng73
------------------------------------------------------------ ------------
Posted via http://www.codecomments.com
------------------------------------------------------------ ------------
RE: How to print label on network shared printer in ASP.Net
am 08.01.2008 20:16:01 von w gaynor
Hi Paul
Would you please send me a sample of your code?
You are helping me out.
Thank you
*** Sent via Developersdex http://www.developersdex.com ***
RE: How to print label on network shared printer in ASP.Net
am 03.04.2008 20:46:21 von Anirudha Gandhe
Hi Paul,
Can you please send me the sample code?
Thanks,
Anirudha
*** Sent via Developersdex http://www.developersdex.com ***