Rah*_*gia 4 usb thermal-printer printers node.js
任何人都知道如何为 Node.js 设置 USB 打印机。我无法为其配置界面。这是我的代码
enter code here const ThermalPrinter = require("../node-thermal-printer").printer;
const Types = require("../node-thermal-printer").types;
const electron = typeof process !== 'undefined' && process.versions &&
!!process.versions.electron;
async function testConnection () {
let printer = new ThermalPrinter({
type: 'star',
interface: "Gold" //name of the printer
});
printer.print("hi");
let isConnected = await printer.isPrinterConnected()
console.log("Printer connected:", isConnected);
}
testConnection();
Run Code Online (Sandbox Code Playgroud)
小智 5
我跳出来的错误是在你的界面中。如果您使用 USB 端口,我建议您首先进行打印共享,然后通过修改值“interface”来配置您的节点终端打印机文件
您修改指示路径和共享打印机的“interface”值
`interface: '//localhost/printer',`
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4005 次 |
| 最近记录: |