1

我正在使用 Epson TM-T82 热敏收据打印机和 QZ 托盘打印收据。当我尝试打印汉字时,产生了奇怪的字符。

下面是配置设置和编码,

var config = qz.configs.create(printer, {encoding: 'GB18030'});

根据 Tres 在线程上的建议,我还尝试使用带有 GB18030 编码的 Visual Studio Code 打印到文件:打印机和查看

https://groups.google.com/forum/#!topic/qz-print/jp68IuW-LcA

所以,我认为我需要为我的打印机型号正确配置 GB18030。

还有什么我可以做的吗?

谢谢你。

4

1 回答 1

1

需要发生三件事:

  1. 您需要一台能够打印中文的打印机(有些需要特殊的固件,如果在中国以外,预计此固件有出口限制)
  2. 您需要知道打印机支持哪种字符编码。
  3. 您需要提供执行此操作的命令。

代码:

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
    // ...
];

注意:在测试时,繁体中文没有像其他语言那样的“国际字符集”命令。希望这些信息有所帮助。

于 2019-11-07T15:07:16.907 回答