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

pdf417 input error #122

Open simo154 opened 5 years ago

simo154 commented 5 years ago
var image = new Image();
image.src = 'assets/imgs/d.jpeg';
image.onload = function() {
var canvas = document.createElement('canvas');
canvas.height = 100;
canvas.width = 100;
var context = canvas.getContext('2d');
context.drawImage(image, 0, 0);
var imageData = canvas.toDataURL('image/jpeg').replace(/^data:image\/(png|jpg|jpeg);base64,/, "");
console.log(imageData);

window.DatecsPrinter.printImage(
    imageData,
    canvas.width,
    canvas.height,
    1,
    function() {
        alert('success!');
    },
    function() {
        alert('error!');
    }
)

};

why it was printed "pdf417 input error" instead of the image?