Closed Gunasekaran15 closed 6 years ago
Could you please share your code?
function call1() {
window.DatecsPrinter.listBluetoothDevices( function (devices) { window.DatecsPrinter.connect(devices[0].address, function() { printSomeTestText(); // printMyBarcode();
// printt();
// printMyImage();
},
function() {
alert(JSON.stringify(error));
}
);
},
function (error) {
alert(JSON.stringify(error));
}
);
//var a="HELLO GUYS "+{br}+"HOW ARE YOU,I'M HAPPY";
function printSomeTestText() {
window.DatecsPrinter.printText("{b}HELLO GUYS HOW ARE {/b}{br} YOU I AM HAPPY.",'ISO-8859-1',success,error);
function success() {
//printMyImage();
alert('success!');
printQRCode();
}
function error(){
alert(JSON.stringify(error));
}
}
function printMyImage() { var image = new Image(); image.src = 'img/logo.png'; image.onload = function() { var canvas = document.createElement('canvas'); canvas.height = 150; canvas.width = 150; var context = canvas.getContext('2d'); context.drawImage(image,0, 0); var imageData = canvas.toDataURL('image/jpeg').replace(/^data:image\/(png|jpg|jpeg);base64,/, ""); //remove mimetype window.DatecsPrinter.printImage( imageData, //base64 canvas.width, canvas.height, 1, function() { alert('success!'); // printMyBarcode(); // printSomeTestText(); }, function(error) { alert(JSON.stringify(error)); } ) }; }
function printQRCode() { window.DatecsPrinter.printQRCode( 4, 4, 'http://giorgiofellipe.com.br', function() { alert('success!'); }, function() { alert(JSON.stringify(error)); } ); } }
Do you call this after cordova.isReady?
yes
Could you please create a repository with the problem isolated?
I tried to print QRcode with my EPSON TM-P20 printer,It prints text,image but it does't print QRcode,It shows the following error window.DatecsPrinter.printQRCode is not a function