It is really difficult to find something on internet to print zebra code from asp.net form
Yes what you will find is javascript to acheive the same. Also its easy to do from windows application.
Issue : when you use javascript , you have to save the image(barcode) on aspx page and then fire the javascript print command. It works well with lazer printer but has issue with Zebra printer as image gets generated but there , we are not able to scan it. So Barcode generated is no use if you are using Zebra printer
Code is simple and strait forward.
It allows you to print barcode and also access zebra printer from asp.net.
1. Install font which is free on .net “3 of 9 Barcode”
2. Create an Asp.net project
3. Add this code
public void Submit_Click(object sender, EventArgs e)
{
try
{
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);
// Set the printer name.
//pd.PrinterSettings.PrinterName = "
file://ns5/hpoffice //pd.PrinterSettings.PrinterName = "Zebra New GK420t"
pd.Print();
}
catch (Exception ex)
{
Response.Write("Error: " + ex.ToString());
}
}
void pd_PrintPage(object sender, PrintPageEventArgs ev)
{
Font printFont = new Font("3 of 9 Barcode", 17);
Font printFont1 = new Font("Times New Roman", 9, FontStyle.Bold);
SolidBrush br = new SolidBrush(Color.Black);
ev.Graphics.DrawString("*texttodisplay*", printFont, br, 10, 65);
ev.Graphics.DrawString("*texttodisplay*", printFont1, br, 10, 85);
}