【发布时间】:2026-02-15 10:55:02
【问题描述】:
我正在尝试使用 node-thermal-printer (https://github.com/Klemen1337/node-thermal-printer/) 连接 ZPL 打印机 (https://chrome.google.com/webstore/detail/zpl-printer/phoidlklenidapnijkabnfdgmadlcmjo)。
当我运行 ZPL 打印机时,我可以通过 URL 浏览器成功访问打印机,地址如下:(http://localhost:9100/)
我使用 node-thermal-printer 连接打印机的 Javascript 代码是:
printer.init({
type: "epson",
interface: "/dev/usb/lp0", // Linux interface
ip: "localhost", // Ethernet printing IP
port: "9100" // Ethernet printing PORT
});
printer.isPrinterConnected( function(isConnected){
console.log(isConnected);
});
运行这个,我连接错了。
在IP地址我也试过了:http://127.0.0.1/和端口:9100,但是不行。
请有人帮我。
对不起,我的英语不好。
【问题讨论】:
标签: javascript node.js printing node-modules thermal-printer