Wednesday, February 24, 2010

Print Zebra barcode label thru' ASP .NET

Recently, one of the projects I am maintaining required me to enhance the existing feature, which is printing the Zebra barcode label through ASP .NET. The old staff who developed it left the company long time ago, and there's no other colleagues know how it was developed and worked.

Printing it as WinForm application is not uncommon with the SerialPort Class, as there's a lot of resources out there, but not so true for ASP .NET.

So I needed to google around and posted question to the forums. With some lucks and googling skills, i managed to let it works and add enhancement on that. But i found not full steps on web, so just to post this to help someone who might need it in the future.

1.a) Set the "Generic/Text Only" as default printer driver. Yes, you see it correctly, it's not zebra printer driver that match your zebra printer, since it's printed through web.

1.b.i) If you do not have it, you can go to any existing printer property page (right-click on any other printer driver) and add this driver.

1.b.ii) Browse to driver list start with "G", then you will find it. Finish this installation process.

2) Once you have the driver, setup the ASP designer with Zebra programming language (ZPL) like this (The buttons are for user to trigger the ZPL to send).

3) By calling the undocumented print() function (not window.print(), and I think it works on IE only) in javascript, you can print the zebra bar-code label through ASP.NET.

4) Keep the web form as clean code as possible, you will send it as ZPL and ZPL only to printer.

5) Print it! You should get it ;)


Craig said...

Very nice solution! I have a question, however. Will this work in a scenario where the client pc is not directly connected to the label printer (i.e. the label printer is a network printer to the client of the app). Seems that specifying the Generic/Text print driver on the client would prohibit choosing the desired network resource? I'm hoping i'm wrong :)

gary said...

network resource? I do no think it works, unless that network printer is specified the Generic/Text print driver. :D

Fernando said...

Thank you very much for your post.
I'm trying to print a barcode label from a web page and i don't understand where you see the result of the print() instruction.

I have not installed any driver of Zebra. I only have my EPSON printer :)

I have selected de Generic/Text Only driver but when i press "Print" button and select the printer nothing happens.

Thanks for your help.

gary said...

EPSON printer? Hmmm..., no idea.
this print() command is undocumented, I also could not find it thru' google, and it's in the part of the existing code that left from my previous colleague.

olen said...

I'm trying to print to a LP 2844. If I change the driver to generic/text only, the printer does not respond to the print request. If I change the driver back to zebra, then it does not interpret the EPL. I have to use EPL on this printer and not ZPL.

Any help is appreciated.

Rahul Mehta said...

what is that zebra programming code and where u get it from

its urgent?

Rahul Mehta said...

what is that zebra programming code.

can u put more light on that

its little urgent

Craig Fordham Site Admin said...

Great idea of printing the Zebra barcode
Plastic Card Printer

Swapnil said...

Can you send the code for the same?...If possible send it on

mya said...

I'm trying to print to a Zebra 2824 with EPL.

With the zebra driver the printer prints the EPL text.

I selected the Generic/Text and when i print and select the printer no document goes to the printer.

Can you help me on this?

Thank you!

mya said...
This comment has been removed by the author.
pricemarking labels said...

This is a nice post. It is all about the zebra labels. It is having a very high demand. Thank you..
zebra labels

vasu0020 said...

Hi gary,

Thanks for your post. I have tried the same approach but the printer printing empty label or printing nothing.

can you please help me on this.

jowdjbrown said...

If you need a more complete shipping solution than what eBay and PayPal offer, some of our Certified Providers can help.Impresion de etiquetas en fibra de coco

E Barcode said...

Hey everyone find here the best Barcode Supplies in Anaheim, CA. EBarcode is the experience group that supplies electronics appliances, printers, scanners and other accessories.

E Barcode said...

nice blog!! visit here for barcodes supplies and scanners.

Dssil Printers said...

Your blog is much effective and thanks for sharing information
DSSIL is a leading System Integration Service Provider renowned for its services in the field of AIDC Bar Coding and RFID technologies

theft control systems for garments

barcode dealers in hyderabad

thermal receipt printer dealers in hyderabad

theft control systems for garments in hyderabad

barcode dealers in vizag

id card printer machine dealers in vizag

barcode label dealers in vizag

barcode color ribbon dealers

Pravali Smiley said...

epson printer support,epson technical support ,epson support,epson customer support,
epson helpline ,epson helpline number,epson customer care
epson technical support