Dear Sir,
I need to print barcode from client Machine, While running the program in Visual studio Barcode prints perfectly whereas once code is published & Put into IIS server the barcode is not printing in client machine rather it prints in server side.
Even if i try to print from client machine it will not work, once barcode printer machine connects with server it prints all the barcode given in client machine as well as in server. Barcode is printing only barcode printer is connected with server not with client.
"I NEED TO PRINT BARCODE FROM CLIENT MACHINE".MY CODE:
protected void btnPrint_Click(object sender, EventArgs e)
{
List<string> list = new List<string>();
foreach (String printer in PrinterSettings.InstalledPrinters)
{
list.Add(printer.ToString());
}
string printerName = "";
for (int i = 0; i < list.Count; i++)
{
printerName = list[i].ToString().ToLower();
if (printerName.Equals(@"tsc ttp-244 plus"))
{
if (list[i].ToString().ToLower().Equals("true"))
{
}
else
{
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);
pd.PrinterSettings.PrinterName = "TSC TTP-244 Plus";
pd.DefaultPageSettings.PaperSize = new PaperSize("Label", 197, 98);
pd.Print();
}
}
}
PlBarcodeFileNo.Controls.Add(_BarcodeImageView(lblBarcode.Text));
}
private System.Web.UI.WebControls.Image _BarcodeImageView(string barCodeimgNo)
{
System.Web.UI.WebControls.Image imgBarCode = new System.Web.UI.WebControls.Image();
using (Bitmap bitMap = new Bitmap(barCodeimgNo.Length * 40, 80))
{
using (Graphics graphics = Graphics.FromImage(bitMap))
{
Font oFont = new Font("IDAutomationHC39M", 16);
PointF point = new PointF(2f, 2f);
SolidBrush blackBrush = new SolidBrush(Color.Black);
SolidBrush whiteBrush = new SolidBrush(Color.White);
graphics.FillRectangle(whiteBrush, 0, 0, bitMap.Width, bitMap.Height);
graphics.DrawString("*" + barCodeimgNo + "*", oFont, blackBrush, point);
}
using (MemoryStream ms = new MemoryStream())
{
bitMap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
byte[] byteImage = ms.ToArray();
Convert.ToBase64String(byteImage);
imgBarCode.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(byteImage);
}
}
return imgBarCode;
}