Open wesleyxiao opened 4 years ago
anyone can tell how to switch printer to two-byte mode please?
@wesleyxiao - that function will only work on the Zjiang ZJ-5890 printer. There is no standard ESC/POS method to print Chinese, and most printers do not appear to be capable of rendering Chinese characters.
You can find some things to try next on our "Text encoding" wiki page.
You might like to try the UnifontPrintBuffer
, which is quite new, and is documented here.
You must download a .hex
file from the Unifont project (see information in the previous link). The usage is then:
// Use Unifont to render text
$unifontBuffer = new UnifontPrintBuffer("/usr/share/unifont/unifont.hex");
$printer -> setPrintBuffer($unifontBuffer);
And this will allow you to print like so:
$printer -> text("这是列子");
The glyphs will be quite large, but this should produce usable output on your printer.
Very thanks mike, i been test this using all the plugin like nodejs thermal-node-printer and escpos node plugin all can't make it work, i am also change escpos-php files still can't make it work, i did a lot of research, take me two days many hours, and i give up last night and purchase a printer from amazon which support two byte character LOL. and i saw you post this morning i am really happy, this make it work, font style is different, but it works, thank you mike.
Hello, i check epson tm-t88v it support both chinese simplify and traditional, but when i use textChinese('这是列子'), my recipe show undefined character。
below code is from escpos-php printer.php public function textChinese($str = "") { self::validateString($str, FUNCTION); $this -> connector -> write(self::FS . "&"); $str = iconv("UTF-8", "BIG5//IGNORE", $str); $this -> buffer -> writeTextRaw((string)$str); $this -> connector -> write(self::FS . "."); }