Hi,
protected void btnsave_Click(object sender, EventArgs e)
{
//string s = "Hello"; // device-dependent string, need a FormFeed?
string ss = "^XA"+"^FO100"+"100^BY7"+"NFD123456^FS"+"^XZ";
//string command = "N" + (char)Keys.LineFeed + "A280,20,1,2,1,1,N,\"CODE:\"" + (char)Keys.LineFeed +
//"A255,20,1,3,1,1,N,\"" + "1234" + "\"" + (char)Keys.LineFeed +
//"P1" + (char)Keys.LineFeed;
// Create a buffer with the command
StringBuilder sb = new StringBuilder();
sb.AppendLine();
sb.AppendLine("N");
sb.AppendLine("q609");
sb.AppendLine("Q203,26");
sb.AppendLine(string.Format(
CultureInfo.InvariantCulture,
"B26,26,0,UA0,2,2,152,B,\"{0}\"",
this.upc));
sb.AppendLine("P1,1");
//Byte[] buffer = new byte[ss.Length];
//buffer = System.Text.Encoding.ASCII.GetBytes(ss);
//// Allow the user to select a printer.
PrintDialog pd1 = new PrintDialog();
pd1.PrinterSettings = new PrinterSettings();
if (DialogResult.OK == pd1.ShowDialog())
{
// Send a printer-specific to the printer.
PrintRaw.SendStringToPrinter(pd1.PrinterSettings.PrinterName, sb.ToString());
}
}
method call this (PrintRaw.SendStringToPrinter(pd1.PrinterSettings.PrinterName, sb.ToString());)
public static bool SendStringToPrinter(string szPrinterName, string szString)
{
IntPtr pBytes;
Int32 dwCount;
dwCount = szString.Length;
pBytes = Marshal.StringToCoTaskMemAnsi(szString);
SendBytesToPrinter(szPrinterName, pBytes, dwCount);
Marshal.FreeCoTaskMem(pBytes);
return true;
}
but not getting print in printer