如何在c#中使用esc/pos命令?

Vic*_*cky 3 c# printing

如何在C#中使用ESC/POS命令?我需要这样的格式在此输入图像描述

但我无法实现这种格式.我尝试了一些代码,但没用.

using (var ms = new MemoryStream())
    using (var bw = new BinaryWriter(ms))
    {
        // Reset the printer bws (NV images are not cleared)
        bw.Write(AsciiControlChars.Escape);
        bw.Write('@');
        bw.Write(AsciiControlChars.Newline);
        bw.Write(AsciiControlChars.Escape);
        bw.Write("_______________________________________________");
        bw.Write(AsciiControlChars.Newline);

        bw.Write("Service           Price         Qty       Total");
        bw.Write("------------------------------------------------");

        bw.Write(AsciiControlChars.GroupSeparator);
        bw.Write('V');
        bw.Write((byte)66);
        bw.Write((byte)3);
        bw.Flush();
        // Send the converted ANSI string to the printer.
    }
Run Code Online (Sandbox Code Playgroud)

小智 7

你可以查看这个链接.我现在使用它和它的工作!

http://www.codeproject.com/Tips/704989/Print-Direct-To-Windows-Printer-EPOS-Receipt 小心使用,您必须知道热敏打印机的ESC/POS命令.如果我没弄错,手动命令必须退出打印机附带的CD.

亲切的问候

额外奖励:http: //www.developerfusion.com/tools/convert/vb-to-csharp/