I have an app which prints some text or image using a imz320 bluetooth printer.
For this, I'm using this plugin: https://github.com/srehanuddin/Cordova-Plugin-Bluetooth-Printer
This is the function (from the plugin) that attempts to print my text:
BTPrinter.list(function (data) {
console.log("Success");
BTPrinter.connect(function (data2) {
console.log("Success");
BTPrinter.print(function (data) {
console.log("Success");
setTimeout(function () {
BTPrinter.disconnect(function (data) {
alert("Success");
console.log(data)
}, function (err) {
console.log("Error");
alert(err)
}, data[0]);
}, 1500);
}, function (err) {
console.log("Error");
alert(err);
}, "^XA^FO10,10^AFN,26,13^FDHello, World!^FS^XZ");//base64 string, align
}, function (err) {
console.log("Error");
alert(JSON.stringify(err));
console.log(err)
}, data[0])
}, function (err) {
alert(JSON.stringify(err));
console.log("Error");
console.log(err);
})
I'm able to connect my device to the printer and even run the print function from my app, which gives me back a message informing me that data was sent. However, the printer does nothing (its lights turning on).