Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use esc/pos command with c#?

Tags:

c#

printing

How to use ESC/POS command with C#? I need format like this enter image description here

but I cannot achieve this format. I tried some codes ,but no use.

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.
    }
like image 662
Vicky Avatar asked Dec 12 '22 08:12

Vicky


1 Answers

You can check this link. I now using that and It's Works!!

http://www.codeproject.com/Tips/704989/Print-Direct-To-Windows-Printer-EPOS-Receipt Use with careful, you must know ESC/POS command for thermal printer. If I'm not mistaken, the manual command must exit on the CD that came with the printer.

Kind Regards

Bonus: http://www.developerfusion.com/tools/convert/vb-to-csharp/

like image 165
egyware Avatar answered Jan 01 '23 04:01

egyware