我使用 react native 和 global esc/pos 移动打印库,库名称是 react-native-bluetooth-escpos-printer。
当我发送图像(base64)时,我有一个错误,即打印图像(1 或 2 行)和蓝牙连接状态已关闭。
//There is my react native code
async printImage(Base) {
try {
await BluetoothEscposPrinter.setWidth(576);
await BluetoothEscposPrinter.printPic(Base, {width: 576, left: 0});
await BluetoothEscposPrinter.printText("\r\n\r\n\r\n", {});
} catch (e) {
alert(e || "ERROR")
}
}
当我发送的图像宽度为 200 像素时,没有错误,但图像很小。
我使用了“等待 BluetoothEscposPrinter.setWidth(576)”,但 setWidth 不起作用。