I am able to print text using cordova-plugin-bluetooth-serial. But the problem is it’s not printing the whole data .
Below is code :
let printData = “\n\n Company Name \n\n\n”;
printData = printData + “----------------------------” + “\n\n” +
"Customer Name: " + details.name + “\n” +
"Phone: " + details.mobile + “\n” +
“Address:” + details.shipping_address + “\n”
+ details.shipping_pin + “,” + details.shipping_city + “\n\n” +
“OrderId:” + details.unique_code + “\n” +
"Delivery Date: " + details.delivery_date + “\n” +
“Delivery Time: " + details.time_span + “\n” +
“No. Of Products: " + products.length + “\n\n” +
“Sl. Name Qty Price” + “\n” +
“" + “\n\n”;
products.forEach((element , index) => {
printData = printData +
Number(index+1) + “. “+element.product_name + " " + element.quantity + " Rs.” + element.price + “/-” +”\n";
});
printData = printData + "” + “\n\n” +
“Payable Amount: Rs.” + details.total_amount +”/-” + “\n\n”;
console.log(printData);
let xyz=this.connectBT(address).subscribe(data=>{
this.btSerial.clear();
this.btSerial.write(printData).then(dataz=>{
console.log("WRITE SUCCESS",dataz);
let mno=this.alertCtrl.create({
title:"Print SUCCESS!",
buttons:['Dismiss']
});
mno.present();
xyz.unsubscribe();
},errx=>{
console.log("WRITE FAILED",errx);
let mno=this.alertCtrl.create({
title:"ERROR "+errx,
buttons:['Dismiss']
});
mno.present();
});
},err=>{
console.log("CONNECTION ERROR",err);
let mno=this.alertCtrl.create({
title:"ERROR "+err,
buttons:['Dismiss']
});
mno.present();
});
Someone please help me !!