I'm writing a WinForm application that's supposed to send a series of commands to the SATO CL4NX label printer. I'm using Visual Studio 2013, C# and I'm using the USB port to print
enter code here. The result of my efforts is that the printer just prints the TEXT of the commands.
For example I'm sending the following string:
What is printed is:
My code is as follows:
StringBuilder sb = new StringBuilder();
String output = sb.ToString().Replace("<ESC>", "\x1B");
output = output.Replace("<STX>", ((char)2).ToString());
output = output.Replace("<ETX>", ((char)3).ToString());
yPos = topMargin + (count * printFont.GetHeight(ev.Graphics));
ev.Graphics.DrawString(output, printFont, Brushes.Black, leftMargin, yPos, new StringFormat());
The actual string that's sent to the printer is:
Can somebody tell me what I'm doing wrong?
Thanks in advance for your help.
My understanding is SATO printer command uses ESC character which is '1B' in hexiadecimal. You actually don't need to send STX and ETX characters. Also, you may want to specify Q command for number of label to be printed:
[1Bh]A [1Bh]H0050 [1Bh]V0100 [1Bh]L0303[1Bh]B[1Bh]XMSATO [1Bh]Q1 [1Bh]Z