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

qrocde image with ??? before #157

Closed coolara closed 3 years ago

coolara commented 3 years ago

this.printQRCode(300,'http://www.baidu.com')
printQRCode(width, url) {
    return new Promise((resolve) => {
      const QRCode = require('yaqrcode');
      const imageBase64 = QRCode(url, {size: 200, errorCorrectionLevel: 'H'});
      const imageData = imageBase64.replace(/^data:image\/(png|jpg|jpeg|gif);base64,/, '');
      window.DatecsPrinter.printImage(
        imageData,
        width,
        width,
        1,
        () => {
          resolve();
        },
        (error) => {
          alert(JSON.stringify(error));
        }
      );
    });
  }
coolara commented 3 years ago

my error code. it's perfect plugin