1

I'm following this post (Printing directly to a thermal printer using ESC/POS Commands executed in C# with an interface of TCP/IP) and I'm able to send text strings to the Ethernet thermal printer and it prints correctly. But I want to print unicode characters and I'm not able to.

I have a unicode character text string, PC is able to show that correctly at MessageBox.Show() etc.. and I want the thermal printer to print the same.

I have tried all the encoding methods but Ethernet thermal printer will print funny characters. If using ASCII, it will print '?'

byte[] data1 = System.Text.Encoding.Default.GetBytes(textString);
byte[] data2 = System.Text.Encoding.UTF32.GetBytes(textString);
byte[] data3 = System.Text.Encoding.UTF8.GetBytes(textString);
byte[] data4 = System.Text.Encoding.UTF7.GetBytes(textString);
byte[] data5 = System.Text.Encoding.Unicode.GetBytes(textString);

I also print the unicode characters on to a graphics area, and my regular USB inkjet printer prints that correctly. I try converting the graphics to byte array and send to the Ethernet thermal printer, that is not working either.

MemoryStream stream = new MemoryStream();
Bitmap bitmap = new Bitmap(width, height, graphics);
bitmap.Save(stream, ImageFormat.Bmp);
byte[] byteArray = stream.GetBuffer();
clientSock.Send(byteArray);

It is a big byteArray data, but the Ethernet thermal printer will print a few funny characters and that's it.

I'm working on a existing HW platform which the current SW can print unicode characters to the same Ethernet thermal printer. I'm trying to develop the SW to replace the existing one. I don't know how the existing SW is doing it, but I guess it will just send data into TCP/IP socket and shouldn't be any driver dependency...

Anyone knows how to achieve this? Thanks in advance.

Community
  • 1
  • 1
  • 1
    You'll need to locate a spec for that printer. If it prints ASCII correctly it is unlikely to also be able to handle Unicode without some sort of mode switch being sent to it first. It is also quite possible that the other software you mention, which works, is sending the output as rendered graphics. – 500 - Internal Server Error Jan 13 '15 at 23:11
  • http://www.snbc.cn/upload/accessory/20151/201514102010418600.pdf – user4420898 Jan 13 '15 at 23:55
  • Good, so you have the manual. I don't see the word Unicode mentioned anywhere in there. – 500 - Internal Server Error Jan 13 '15 at 23:57
  • Thank you very much for reply. I found the spec online. Looks like user is able to set the Font type by sending commands to the thermal printer. Will look into to this. Appreciate your help here! (I hit the enter too early previously....) – user4420898 Jan 14 '15 at 00:04

0 Answers0