在 Birch 打印机上使用 ESC/POS 更改代码页
我正在使用QZ托盘工具使用ESC/POS命令将原始数据发送到热打印机。这是我使用的代码,并且在大多数打印机上都可以正常工作:
data = [
"\x1b\x40",
"\x1b\x74\x49", // ESC t 73 - switch to Windows-1251
text + "\r\n",
"\x1B\x74\x48", // ESC t 72 - switch to Windows-1250
text + "\r\n",
];
let config = qz.configs.create('printer_name', { encoding: 'windows-1251' });
qz.print(config, print_data).catch(function(e) {
console.error(e);
});
我遇到的问题是桦木CP-Q3打印机。如果N大于33,则该打印机似乎不会执行ESC T N
命令。就像它无法识别这些代码页面一样。命令ESC T N
如果N小于33。
最奇怪的是,我可以将代码页面切换为73,例如使用打印机工具,但是使用ESC/POS命令无法完成。打印机自我测试还包含那些代码页。
在更改代码页面或打印机配置之前,我应该执行一个命令,以便可以使用扩展代码页面?
I am using QZ Tray tool to send raw data to thermal printer using ESC/POS commands. This is the code I'm using and it's working as expected on most printers:
data = [
"\x1b\x40",
"\x1b\x74\x49", // ESC t 73 - switch to Windows-1251
text + "\r\n",
"\x1B\x74\x48", // ESC t 72 - switch to Windows-1250
text + "\r\n",
];
let config = qz.configs.create('printer_name', { encoding: 'windows-1251' });
qz.print(config, print_data).catch(function(e) {
console.error(e);
});
The issues I am having are with Birch CP-Q3 printer. This printer doesn't seem to execute ESC t n
command if the n is greater than 33. Like that it doesn't recognize those code pages. Command ESC t n
works fine if the n is less than 33.
Strangest thing is that I can switch code page to 73 for example using printer tool, but it can't be done using ESC/POS commands. Printer self test also contains those code pages.
Is there a command that I should execute before changing code page or a printer configuration that I can change so that extended code pages can be used?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我给 Birch-POS 支持人员发了电子邮件,他们说了以下内容:
这与OPs的wireshark评论相匹配,引用:
不幸的是,JavaScript(特别是UTF-8)不喜欢某些转义序列
x7F
。工作代码应该如下所示:
I emailed Birch-POS support and they say the following:
Which matches the OPs wireshark comment, quoting:
Unfortunately, JavaScript (specifically, UTF-8) does not like certain escape sequences over
x7F
.The working code should look like this: