Error: COMMAND_NOT_SEND
I can't get it to print, it worked only once, then it didn't work again, can you help me?
useEffect(()=>{
BluetoothManager.isBluetoothEnabled().then((enabled)=> {
setEnableBlue(enabled);
if(enabled){
BluetoothManager.enableBluetooth().then((r)=>{
var paired = [];
if(r && r.length>0){
for(var i=0;i<r.length;i++){
try{
let obj=JSON.parse(r[i]);
if(obj.address==="34:81:F4:36:52:BD"){
BluetoothManager.connect(obj.address).then(async(s)=>{
console.log("S====",s)
setEstadoBlue("CONECTADO AL DISPOSITIVO :"+obj.name);
await BluetoothEscposPrinter.printText("ESTA IMPRIMIENDO sera que necesita mas texto\n\r",{})
},
(err)=>{
setEstadoBlue("SIN CONEXION AL DISPOSITIVO :"+obj.name)
})
}
}catch(e){
//ignore
}
}
}
console.log(JSON.stringify(paired))
},(err)=>{
alert(err)
});
}
}, (err)=> {
setEnableBlue(false)
alert(err)
});
},[])
At the end of your document, add this line and it will print:
await BluetoothEscposPrinter.printText("\n\r\n\r\n\r",{});
Hope this helps :)
same error with printPic on IOS. How to fix it?
i have the same issue on IOS , Did any one Solve it ?
this worked for me BluetoothManager.enableBluetooth().then( (r) => { var paired = []; if (r && r.length > 0) { for (var i = 0; i < r.length; i++) { try { paired.push(JSON.parse(r[i])); let obj=JSON.parse(r[i]); if (obj.address === "20:18:05:22:03:06") { BluetoothManager.connect(obj.address) .then((s)=>{ console.log("S====",s) BluetoothEscposPrinter.printerAlign(BluetoothEscposPrinter.ALIGN.CENTER); BluetoothEscposPrinter.setBlob(0); BluetoothEscposPrinter.printText("EazyFlow\n\r", { encoding: "GBK", codepage: 0, widthtimes: 1, heigthtimes: 1, fonttype: 0, }); BluetoothEscposPrinter.setBlob(0); BluetoothEscposPrinter.printText("Facture\n\r", { encoding: "GBK", codepage: 0, widthtimes: 0, heigthtimes: 0, fonttype: 0, }); BluetoothEscposPrinter.printerAlign(BluetoothEscposPrinter.ALIGN.LEFT); BluetoothEscposPrinter.printText("Label:Vente des marchandise\n\r", {}); BluetoothEscposPrinter.printText("Code:xsd201909210000001\n\r", {}); BluetoothEscposPrinter.printText( "Date:" +new Date().getDate()+"-"+(new Date().getMonth()+1)+"-"+new Date().getFullYear() + "\n\r", {} ); BluetoothEscposPrinter.printText("Number:18664896621\n\r", {}); BluetoothEscposPrinter.printText( "--------------------------------\n\r", {} ); BluetoothEscposPrinter.printText("Amount:64000.00\n\r", {}); BluetoothEscposPrinter.printText("Tax:0.00\n\r", {}); BluetoothEscposPrinter.printText("Total:64000.00\n\r", {}); BluetoothEscposPrinter.printText( "--------------------------------\n\r", {} ); BluetoothEscposPrinter.printerAlign(BluetoothEscposPrinter.ALIGN.CENTER); BluetoothEscposPrinter.printText("Thanks for payment\n\r\n\r\n\r\n\r", {}); BluetoothEscposPrinter.printerAlign(BluetoothEscposPrinter.ALIGN.LEFT); }) } } catch (e) { //ignore } } } console.log(JSON.stringify(paired)); }, (err) => { alert(err); } );
this worked for me BluetoothManager.enableBluetooth().then( (r) => { var paired = []; if (r && r.length > 0) { for (var i = 0; i < r.length; i++) { try { paired.push(JSON.parse(r[i])); let obj=JSON.parse(r[i]); if (obj.address === "20:18:05:22:03:06") { BluetoothManager.connect(obj.address) .then((s)=>{ console.log("S====",s) BluetoothEscposPrinter.printerAlign(BluetoothEscposPrinter.ALIGN.CENTER); BluetoothEscposPrinter.setBlob(0); BluetoothEscposPrinter.printText("EazyFlow\n\r", { encoding: "GBK", codepage: 0, widthtimes: 1, heigthtimes: 1, fonttype: 0, }); BluetoothEscposPrinter.setBlob(0); BluetoothEscposPrinter.printText("Facture\n\r", { encoding: "GBK", codepage: 0, widthtimes: 0, heigthtimes: 0, fonttype: 0, }); BluetoothEscposPrinter.printerAlign(BluetoothEscposPrinter.ALIGN.LEFT); BluetoothEscposPrinter.printText("Label:Vente des marchandise\n\r", {}); BluetoothEscposPrinter.printText("Code:xsd201909210000001\n\r", {}); BluetoothEscposPrinter.printText( "Date:" +new Date().getDate()+"-"+(new Date().getMonth()+1)+"-"+new Date().getFullYear() + "\n\r", {} ); BluetoothEscposPrinter.printText("Number:18664896621\n\r", {}); BluetoothEscposPrinter.printText( "--------------------------------\n\r", {} ); BluetoothEscposPrinter.printText("Amount:64000.00\n\r", {}); BluetoothEscposPrinter.printText("Tax:0.00\n\r", {}); BluetoothEscposPrinter.printText("Total:64000.00\n\r", {}); BluetoothEscposPrinter.printText( "--------------------------------\n\r", {} ); BluetoothEscposPrinter.printerAlign(BluetoothEscposPrinter.ALIGN.CENTER); BluetoothEscposPrinter.printText("Thanks for payment\n\r\n\r\n\r\n\r", {}); BluetoothEscposPrinter.printerAlign(BluetoothEscposPrinter.ALIGN.LEFT); }) } } catch (e) { //ignore } } } console.log(JSON.stringify(paired)); }, (err) => { alert(err); } );
this works as expected thanks @Benjamin1-pro