Javascript 如何使用节点热敏打印机连接到ZPL打印机?

Javascript 如何使用节点热敏打印机连接到ZPL打印机?,javascript,node.js,printing,node-modules,thermal-printer,Javascript,Node.js,Printing,Node Modules,Thermal Printer,我正在尝试使用节点热敏打印机()连接ZPL打印机() 当我运行ZPL打印机时,我可以通过URL浏览器在以下地址成功访问打印机:() 使用节点热敏打印机连接打印机的Javascript代码是: printer.init({ type: "epson", interface: "/dev/usb/lp0", // Linux interface ip: "localhost", //

我正在尝试使用节点热敏打印机()连接ZPL打印机()

当我运行ZPL打印机时,我可以通过URL浏览器在以下地址成功访问打印机:()

使用节点热敏打印机连接打印机的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
,但它不工作

请有人帮帮我


对不起,我的英语不好。

如果您的打印机是网络打印机,请尝试以下操作:

printer.init({
  type: 'epson',
  interface: 'tcp://yourip:9100',

});
用打印机ip替换您的ip