giorgiofellipe / cordova-plugin-datecs-printer

Cordova plugin to print on Mobile Bluetooth ESC/POS Printers - Tested on Datecs DPP-250 Printer
MIT License
73 stars 60 forks source link

QRcode not printed #94

Closed Gunasekaran15 closed 6 years ago

Gunasekaran15 commented 6 years ago

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

giorgiofellipe commented 6 years ago

Could you please share your code?

Gunasekaran15 commented 6 years ago

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)); } ); } }

giorgiofellipe commented 6 years ago

Do you call this after cordova.isReady?

Gunasekaran15 commented 6 years ago

yes

giorgiofellipe commented 6 years ago

Could you please create a repository with the problem isolated?