我正在使用Epson TM-T82热敏票据打印机和QZ托盘来打印票据。当我尝试打印汉字时,会产生奇数字符。
下面是配置设置和编码,
var config = qz.configs.create(printer,{encoding:'GB18030'});
我也尝试打印到FILE:打印机,并使用Visual Studio Code和GB18030编码进行查看,根据Tres在线程上的建议
https://groups.google.com/forum/#!topic/qz-print/jp68IuW-LcA
所以,我认为我的打印机型号需要GB18030的正确配置。
我还能做其他事情吗?
谢谢。
需要发生三件事:
代码:
var config = qz.configs.create("Printer Name", {encoding: 'Big5'}); // *Epson T88 models with correct firmware. Toggles Big5 with Hong Kong extensions.
// {encoding: 'GBK'}); // Fuken POS90 ships with GB18030, but in testing, 'GBK' is required
var printData = [
'\x1B' + '\x40', // ESC @ - init command, necessary for proper byte interpretation
'艾德蒙 AOC E2450SWH 23.6吋\n',
' LED液晶寬螢幕特價$ 19900',
'\x0A' + '\x0A' + '\x0A' + '\x0A' + '\x0A' + '\x0A' + '\x0A',
'\x0A' + '\x0A' + '\x0A' + '\x0A' + '\x0A' + '\x0A' + '\x0A',
'\x1B' + '\x69' // cut paper
];
qz.print(config, printData);
某些编程手册还指定:
var printData = [
// ...
'\x1C' + '\x26' // Enter Hanzi (Japanese/Chinese/ Taiwanese/Korean Kanji Specifications) mode
// ...
];
注:测试时,繁体中文没有像其他语言一样具有“国际字符集”命令。希望这些信息对您有所帮助。