Barcode Printing Sato LM408e c#

烂漫一生 提交于 2019-12-12 02:56:11

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!