Reputation: 145
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 printenter 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:
"<STX><ESC>AH0050<ESC>V0100<ESC>L0303<ESC>B<ESC>XMSATO<ESC>Z<ETX>"
What is printed is:
"<STX><ESC>AH0050<ESC>V0100<ESC>L0303<ESC>B<ESC>XMSATO<ESC>Z<ETX>"
My code is as follows:
StringBuilder sb = new StringBuilder();
sb.AppendLine();
sb.AppendLine("<STX><ESC>A");
sb.AppendLine("H0050<ESC>V0100<ESC>L0303<ESC>B<ESC>XMSATO<ESC>Z<ETX>");
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:
\r\nA\r\nH0050V0100L0303BXMSATOZ\r\n
Can somebody tell me what I'm doing wrong?
Thanks in advance for your help. Steve
Upvotes: 0
Views: 1101
Reputation: 1
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
Upvotes: 0