如何解决节点USB打印机
任何人都知道如何为 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();
解决方法
跳出我的错误是在您的界面中。 如果您使用 USB 端口,我建议您首先进行打印共享,然后通过修改值“interface”来配置您的节点终端打印机文件
-
你修改了表示路径和共享打印机的值“interface”
#include <iostream> #include <string> using namespace std; string topSecret(string);//prototype for topSecret function after main int main() { //Top Secret Input string name,social,userName,password; cout << "Enter your first name,Social Security number (digits only),userID (no spaces within ID),and password (no spaces within password) - with a space between each entry: "; cin >> name >> social >> userName >> password; cout << "Name: " << name << endl; cout << "SSN: " << social.replace(0,social.length(),"X"); cout << "SSN: " << social.insert(2,"-") << endl; cout << "UserID: " << userName << endl; cout << "Password: " << topSecret(password) << endl; return 0; }//end main string topSecret (string password)//replace all characters in password to an X { string::size_type length; string::size_type pw; for (pw = 0; pw < password.length(); pw++)//for the duration of the password { }//end for loop }//end topSecret
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。