mtmsuhail / ESC-POS-USB-NET

This project is a simple .NET (C#) Implementation of the Epson ESC/POS Printing using USB Device Driver.
MIT License
202 stars 86 forks source link

Not working with encoding Shift_JIS #73

Open ryantranvortech opened 2 weeks ago

ryantranvortech commented 2 weeks ago

It's awesome. Thanks so much!

Printer printer = new Printer("EPSON TM-T(203dpi_1) Receipt6", "Shift_JIS");

Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); Encoding encoding = Encoding.GetEncoding("Shift_JIS");

printer.InitializePrint();

printer.Append(new byte[] { 0x1B, 0x74, 0x12 });

printer.SetLineHeight(24);

string japaneseText = "テスト"; byte[] japaneseBytes = encoding.GetBytes(japaneseText);

printer.Append(japaneseBytes);

printer.FullPaperCut(); printer.PrintDocument();