I'm new to programming.
I want to print direct to the Zebra Printer without setting the printer as a DEFAULT because I'm using one computer that is connected to many printers, and also bear in mind i'm getting the records/DATA from a web browser when PRINT Button is clicked
How can i achieve this ? Thanks in advance.
The following code works fine if the printer is set to DEFAULTS
<%@ Page Language="C#" AutoEventWireup="true"%> <%@ Import Namespace="System.Data.SqlClient" %> <%@ Import Namespace="System.IO" %> <% System.Web.Script.Serialization.JavaScriptSerializer jsoner = new System.Web.Script.Serialization.JavaScriptSerializer(); string UtiWayBillNumber =Request.QueryString["UtiWayBillNumber"]; string labelSerials = Request.QueryString["labelSerials"] ?? null; string[] serialNumbers = labelSerials.Split('$'); using (SqlConnection dbConnection = new System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings["HestoProductionControl"].ConnectionString)) { dbConnection.Open(); SqlCommand cmd = dbConnection.CreateCommand(); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandText = "GM_GetShipmentDetailInformation"; cmd.Parameters.AddWithValue("@utiWaybillNumber", UtiWayBillNumber); SqlDataReader reader = cmd.ExecuteReader(); System.Collections.Generic.List<object> labelList = new List<object>(); string appPath = Request.PhysicalApplicationPath; string IPAddress = HttpContext.Current.Request.UserHostAddress; StringBuilder fileContents = new StringBuilder(); while (reader.Read()) { if (labelSerials.StartsWith(" ")) { DateTime date = DateTime.Now; string quantity = reader["PackingQuantity"].ToString(); quantity = quantity.Remove(2,7); fileContents.Append(reader["HestoBarcodeSerial"]); fileContents.Append(","); fileContents.Append(reader["CustomerStockCode"].ToString().Trim()); fileContents.Append(","); fileContents.Append(quantity); fileContents.Append(","); fileContents.Append(reader["Description"].ToString().Trim()); fileContents.Append(","); fileContents.Append(reader["StockCode"]); fileContents.Append(","); fileContents.Append(date.ToString("s")); fileContents.Append(","); fileContents.Append(reader["CustomerBarcodeSerial"]); fileContents.Append("\r\n"); } else{ DateTime date = DateTime.Now; string quantity = reader["PackingQuantity"].ToString(); quantity = quantity.Remove(2,7); if (serialNumbers.Contains<string>(reader["Serial"].ToString()) == false) { continue; } fileContents.Append(reader["HestoBarcodeSerial"]); fileContents.Append(","); fileContents.Append(reader["CustomerStockCode"].ToString().Trim()); fileContents.Append(","); fileContents.Append(quantity); fileContents.Append(","); fileContents.Append(reader["Description"].ToString().Trim()); fileContents.Append(","); fileContents.Append(reader["StockCode"]); fileContents.Append(","); fileContents.Append(date.ToString("s")); fileContents.Append(","); fileContents.Append(reader["CustomerBarcodeSerial"]); fileContents.Append("\r\n"); } }; Response.Write(fileContents.ToString()); Directory.CreateDirectory(appPath + "//PrintFile/" + IPAddress); StreamWriter w; w = File.CreateText(appPath + "//PrintFile/" + IPAddress + "/printLabels.txt"); w.WriteLine(fileContents.ToString()); w.Flush(); w.Close(); } %>