esc_pos_printer
esc_pos_printer copied to clipboard
how to print thai language?
Hi, Have you tried this: https://github.com/andrey-ushakov/esc_pos_utils#using-code-tables ?
I've tried and I've got the wrong output as below. It's about a problem of tone marks float in Thai language. I'm not sure it's because of my device or not. Please advice.

I would suggest you print the self-test ticket and check the code page id your printer uses for Thai. It could be 70, 96, 255 or another value depending on your printer (look for 'thai' or 'cp874' code pages).
After that, use this value like this:
ticket.textEncoded(encThai, styles: PosStyles(codeTable: PosCodeTable(<CODE_PAGE>)));
I hope this helps!
I've tried but It's still not work. Here is my code:
Uint8List encThai =
await CharsetConverter.encode("cp874", "Thai: ใบเสร็จ-ใบรับผ้า");
ticket.textEncoded(encThai,
styles: PosStyles(codeTable: PosCodeTable.thai_1));
ticket.feed(1);
ticket.cut();
final PosPrintResult res = await printerManager.printTicket(ticket);
print(res.msg);
And I tried to print all available charsets by using CharsetConverter.availableCharsets() but I've not found 'thai' or 'cp874' charset.
Here is my code for print all available charsets:
List<String> charsets = await CharsetConverter.availableCharsets();
charsets.forEach((item) {
print(item);
});
And the result is below,
I/flutter (22649): Adobe-Standard-Encoding I/flutter (22649): Big5 I/flutter (22649): Big5-HKSCS I/flutter (22649): BOCU-1 I/flutter (22649): CESU-8 I/flutter (22649): cp1363 I/flutter (22649): cp851 I/flutter (22649): EUC-JP I/flutter (22649): EUC-KR I/flutter (22649): GB18030 I/flutter (22649): GBK I/flutter (22649): hp-roman8 I/flutter (22649): HZ-GB-2312 I/flutter (22649): IBM-Thai I/flutter (22649): IBM00858 I/flutter (22649): IBM01140 I/flutter (22649): IBM01141 I/flutter (22649): IBM01142 I/flutter (22649): IBM01143 I/flutter (22649): IBM01144 I/flutter (22649): IBM01145 I/flutter (22649): IBM01146 I/flutter (22649): IBM01147 I/flutter (22649): IBM01148 I/flutter (22649): IBM01149 I/flutter (22649): IBM037 I/flutter (22649): IBM1026 I/flutter (22649): IBM1047 I/flutter (22649): IBM273 I/flutter (22649): IBM277 I/flutter (22649): IBM278 I/flutter (22649): IBM280 I/flutter (22649): IBM284 I/flutter (22649): IBM285 I/flutter (22649): IBM290 I/flutter (22649): IBM297 I/flutter (22649): IBM420 I/flutter (22649): IBM424 I/flutter (22649): IBM437 I/flutter (22649): IBM500 I/flutter (22649): IBM775 I/flutter (22649): IBM850 I/flutter (22649): IBM852 I/flutter (22649): IBM855 I/flutter (22649): IBM857 I/flutter (22649): IBM860 I/flutter (22649): IBM861 I/flutter (22649): IBM862 I/flutter (22649): IBM863 I/flutter (22649): IBM864 I/flutter (22649): IBM865 I/flutter (22649): IBM866 I/flutter (22649): IBM868 I/flutter (22649): IBM869 I/flutter (22649): IBM870 I/flutter (22649): IBM871 I/flutter (22649): IBM918 I/flutter (22649): ISO-2022-CN I/flutter (22649): ISO-2022-CN-EXT I/flutter (22649): ISO-2022-JP I/flutter (22649): ISO-2022-JP-1 I/flutter (22649): ISO-2022-JP-2 I/flutter (22649): ISO-2022-KR I/flutter (22649): ISO-8859-1 I/flutter (22649): ISO-8859-10 I/flutter (22649): ISO-8859-13 I/flutter (22649): ISO-8859-14 I/flutter (22649): ISO-8859-15 I/flutter (22649): ISO-8859-2 I/flutter (22649): ISO-8859-3 I/flutter (22649): ISO-8859-4 I/flutter (22649): ISO-8859-5 I/flutter (22649): ISO-8859-6 I/flutter (22649): ISO-8859-7 I/flutter (22649): ISO-8859-8 I/flutter (22649): ISO-8859-9 I/flutter (22649): KOI8-R I/flutter (22649): KOI8-U I/flutter (22649): macintosh I/flutter (22649): SCSU I/flutter (22649): Shift_JIS I/flutter (22649): TIS-620 I/flutter (22649): US-ASCII I/flutter (22649): UTF-16 I/flutter (22649): UTF-16BE I/flutter (22649): UTF-16LE I/flutter (22649): UTF-32 I/flutter (22649): UTF-32BE I/flutter (22649): UTF-32LE I/flutter (22649): UTF-7 I/flutter (22649): UTF-8 I/flutter (22649): windows-1250 I/flutter (22649): windows-1251 I/flutter (22649): windows-1252 I/flutter (22649): windows-1253 I/flutter (22649): windows-1254 I/flutter (22649): windows-1255 I/flutter (22649): windows-1256 I/flutter (22649): windows-1257 I/flutter (22649): windows-1258 I/flutter (22649): x-compound-text I/flutter (22649): x-ebcdic-xml-us I/flutter (22649): x-euc-tw-2014 I/flutter (22649): x-gsm-03.38-2009 I/flutter (22649): x-ibm-1047-s390 I/flutter (22649): x-ibm-1125_P100-1997 I/flutter (22649): x-ibm-1129_P100-1997 I/flutter (22649): x-ibm-1130_P100-1997 I/flutter (22649): x-ibm-1131_P100-1997 I/flutter (22649): x-ibm-1132_P100-1998 I/flutter (22649): x-ibm-1133_P100-1997 I/flutter (22649): x-ibm-1137_P100-1999 I/flutter (22649): x-ibm-1140-s390 I/flutter (22649): x-ibm-1141-s390 I/flutter (22649): x-ibm-1142-s390 I/flutter (22649): x-ibm-1143-s390 I/flutter (22649): x-ibm-1144-s390 I/flutter (22649): x-ibm-1145-s390 I/flutter (22649): x-ibm-1146-s390 I/flutter (22649): x-ibm-1147-s390 I/flutter (22649): x-ibm-1148-s390 I/flutter (22649): x-ibm-1149-s390 I/flutter (22649): x-ibm-1153-s390 I/flutter (22649): x-ibm-1154_P100-1999 I/flutter (22649): x-ibm-1155_P100-1999 I/flutter (22649): x-ibm-1156_P100-1999 I/flutter (22649): x-ibm-1157_P100-1999 I/flutter (22649): x-ibm-1158_P100-1999 I/flutter (22649): x-ibm-1160_P100-1999 I/flutter (22649): x-ibm-1162_P100-1999 I/flutter (22649): x-ibm-1164_P100-1999 I/flutter (22649): x-ibm-1250_P100-1995 I/flutter (22649): x-ibm-1251_P100-1995 I/flutter (22649): x-ibm-1252_P100-2000 I/flutter (22649): x-ibm-1253_P100-1995 I/flutter (22649): x-ibm-1254_P100-1995 I/flutter (22649): x-ibm-1255_P100-1995 I/flutter (22649): x-ibm-1256_P110-1997 I/flutter (22649): x-ibm-1257_P100-1995 I/flutter (22649): x-ibm-1258_P100-1997 I/flutter (22649): x-ibm-12712-s390 I/flutter (22649): x-ibm-12712_P100-1998 I/flutter (22649): x-ibm-1373_P100-2002 I/flutter (22649): x-ibm-1383_P110-1999 I/flutter (22649): x-ibm-1386_P100-2001 I/flutter (22649): x-ibm-16684_P110-2003 I/flutter (22649): x-ibm-16804-s390 I/flutter (22649): x-ibm-16804_X110-1999 I/flutter (22649): x-ibm-25546 I/flutter (22649): x-ibm-33722_P12A_P12A-2009_U2 I/flutter (22649): x-ibm-37-s390 I/flutter (22649): x-ibm-4517_P100-2005 I/flutter (22649): x-ibm-4899_P100-1998 I/flutter (22649): x-ibm-4909_P100-1999 I/flutter (22649): x-ibm-4971_P100-1999 I/flutter (22649): x-ibm-5123_P100-1999 I/flutter (22649): x-ibm-5351_P100-1998 I/flutter (22649): x-ibm-5352_P100-1998 I/flutter (22649): x-ibm-5353_P100-1998 I/flutter (22649): x-ibm-5478_P100-1995 I/flutter (22649): x-ibm-803_P100-1999 I/flutter (22649): x-ibm-813_P100-1995 I/flutter (22649): x-ibm-8482_P100-1999 I/flutter (22649): x-ibm-901_P100-1999 I/flutter (22649): x-ibm-902_P100-1999 I/flutter (22649): x-ibm-9067_X100-2005 I/flutter (22649): x-ibm-916_P100-1995 I/flutter (22649): x-IBM1006 I/flutter (22649): x-IBM1025 I/flutter (22649): x-IBM1097 I/flutter (22649): x-IBM1098 I/flutter (22649): x-IBM1112 I/flutter (22649): x-IBM1122 I/flutter (22649): x-IBM1123 I/flutter (22649): x-IBM1124 I/flutter (22649): x-IBM1153 I/flutter (22649): x-IBM1363 I/flutter (22649): x-IBM1364 I/flutter (22649): x-IBM1371 I/flutter (22649): x-IBM1388 I/flutter (22649): x-IBM1390 I/flutter (22649): x-IBM1399 I/flutter (22649): x-IBM33722 I/flutter (22649): x-IBM720 I/flutter (22649): x-IBM737 I/flutter (22649): x-IBM856 I/flutter (22649): x-IBM867 I/flutter (22649): x-IBM874 I/flutter (22649): x-IBM875 I/flutter (22649): x-IBM922 I/flutter (22649): x-IBM930 I/flutter (22649): x-IBM933 I/flutter (22649): x-IBM935 I/flutter (22649): x-IBM937 I/flutter (22649): x-IBM939 I/flutter (22649): x-IBM942 I/flutter (22649): x-IBM943 I/flutter (22649): x-IBM949 I/flutter (22649): x-IBM949C I/flutter (22649): x-IBM950 I/flutter (22649): x-IBM954 I/flutter (22649): x-IBM964 I/flutter (22649): x-IBM970 I/flutter (22649): x-IBM971 I/flutter (22649): x-IMAP-mailbox-name I/flutter (22649): x-iscii-be I/flutter (22649): x-iscii-gu I/flutter (22649): x-iscii-ka I/flutter (22649): x-iscii-ma I/flutter (22649): x-iscii-or I/flutter (22649): x-iscii-pa I/flutter (22649): x-iscii-ta I/flutter (22649): x-iscii-te I/flutter (22649): x-ISCII91 I/flutter (22649): x-ISO-2022-CN-CNS I/flutter (22649): x-iso-8859-11 I/flutter (22649): x-JavaUnicode I/flutter (22649): x-JavaUnicode2 I/flutter (22649): x-JIS7 I/flutter (22649): x-JIS8 I/flutter (22649): x-LMBCS-1 I/flutter (22649): x-mac-centraleurroman I/flutter (22649): x-mac-cyrillic I/flutter (22649): x-mac-greek I/flutter (22649): x-mac-turkish I/flutter (22649): x-MS950-HKSCS I/flutter (22649): x-UnicodeBig I/flutter (22649): x-UTF-16LE-BOM I/flutter (22649): x-UTF16_OppositeEndian I/flutter (22649): x-UTF16_PlatformEndian I/flutter (22649): x-UTF32_OppositeEndian I/flutter (22649): x-UTF32_PlatformEndian
Have you tried IBM-Thai ?
@hirunsr
Did you find any solution? I am having the same problem with Japanese characters. Please share if you have found any solution.
@hirunsr
Did you find any solution? I am having the same problem with Japanese characters. Please share if you have found any solution.
Sorry for late reply, I'm still having a problem but I fixed it by capturing the screen to an image and printing it instead.
I have the same questions.
@hirunsr Did you find any solution? I am having the same problem with Japanese characters. Please share if you have found any solution.
Sorry for late reply, I'm still having a problem but I fixed it by capturing the screen to an image and printing it instead.
Hi How to capturing the screen? I tried but failed.
-
Declare global key class variable

-
Add RepaintBoundary in body

-
In _printTicket function, create RenderRepaintBoundary object and send it to _createTicket function

- In _createTicket function, use function boundary.toImage() to convert screen to image

- Declare global key class variable
- Add RepaintBoundary in body
- In _printTicket function, create RenderRepaintBoundary object and send it to _createTicket function
- In _createTicket function, use function boundary.toImage() to convert screen to image
thanks for your code,But my printer is too slow to print image.
try this
Uint8List encThai = await CharsetConverter.encode(
'TIS-620', 'Thai: แกงจืดเต้าหู้หมูสับ แกงป่า');
ticket.textEncoded(encThai);

i hope can help you.
try this
Uint8List encThai = await CharsetConverter.encode( 'TIS-620', 'Thai: แกงจืดเต้าหู้หมูสับ แกงป่า'); ticket.textEncoded(encThai);
i hope can help you.
Which brand Printer you use?
any update ?
try this
Uint8List encThai = await CharsetConverter.encode( 'TIS-620', 'Thai: แกงจืดเต้าหู้หมูสับ แกงป่า'); ticket.textEncoded(encThai);
i hope can help you.
it still prints weird for me
hirunsr
@hirunsr
I tried with a hello world text, it prints very pixelated-like with space in between. Were you able to get a decent looking receipt with this method?