问题
I'm making an application that produce barcode labels. I'm using Sato LM408e thermal printer. In order to print i'm using sbpl command. I got no error but the printer doesnt print anything. Is there anyone who has experience printing with sato barcode printer? lm 408e to be more specific
My Code:
PrintDialog printDia = new PrintDialog();
printDia.PrinterSettings = new PrinterSettings();
DialogResult result = printDia.ShowDialog();
StringBuilder sb = new StringBuilder();
sb.AppendLine("<STX><ESC>A");
sb.AppendLine("<ESC>H0001<ESC>V0001<ESC>XM45676567");
sb.AppendLine("<ESC>Q1");
sb.AppendLine("<ESC>Z<ETX>")
String output = sb.ToString().Replace("<ESC>", ((char)27).ToString());
output.Replace("<STX>",((char)2).ToString());
output.Replace("<ETX>", ((char)3).ToString());
if (result == DialogResult.OK)
{
RawPrinterHelper.SendStringToPrinter(printDia.PrinterSettings.PrinterName, output);
}
my string output: output
回答1:
I use CL4NX, CL408e, and GL408e label printers except I print labels that are in Non-Standard SBPL (but it's not that much different than standard).
Since nothing is happening, the first thing I would check is that the printer is online and connected properly. You can use the SATO All-In-One Tool to help you with this. Is the printer connected directly to the machine you're trying to print from or is it a network share?
I would also look at your code, as I'm not sure you need the STX and ETX with SBPL by default. Try printing without them and see if it makes a difference.
Lastly, I would check your Dipswitch settings (LM408e Manual). I've had problems like yours before where it took me a while to realize that the Dipswitch settings weren't as they should be.
回答2:
You cannot send ESC (hex 1B) or STX (hex 02) in plain text. SBPL uses binary data. Try this:
sb.AppendLine("\02\1bA");
... and so on.
来源:https://stackoverflow.com/questions/30802418/barcode-printing-sato-lm408e-c-sharp