Open uokivan opened 5 years ago
I use ionic3 to make the mobile app , and install cordova-plugin-datecs-printer
When I use the sample code to print image, can't print image
here is my code (just like the sample code):
function printMyImage() { var image = new Image(); image.onload = function() { var canvas = document.createElement('canvas'); canvas.height = 50; canvas.width = 50; 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() { printMyBarcode(); }, function(Error) { alert(JSON.stringify(Error)); } ) }; image.src = 'assets/imgs/Logo2.jpg'; }
I use ionic3 to make the mobile app , and install cordova-plugin-datecs-printer
When I use the sample code to print image, can't print image
here is my code (just like the sample code):
function printMyImage() { var image = new Image(); image.onload = function() { var canvas = document.createElement('canvas'); canvas.height = 50; canvas.width = 50; 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() { printMyBarcode(); }, function(Error) { alert(JSON.stringify(Error)); } ) }; image.src = 'assets/imgs/Logo2.jpg'; }