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

Error when I tried to print image #126

Closed jomora15 closed 5 years ago

jomora15 commented 5 years ago

Hi! I'm trying to print in a Datamax o'neil Apex2 printer. Print text works perfectly but image or barcode doesn't work. This is the image error.

error

My code: testPrint(printerAddress) { window.DatecsPrinter.connect(printerAddress, () => { window.DatecsPrinter.printImage(printData, 200, 200, 1, () => { alert('imprio'); }, (err) => { alert('no imprio ' +JSON.stringify(err)); }) }, (err) => alert('err: ' + JSON.stringify(err))); }

printData is a base64 string.

When I'm trying to print BarCode I have timeout

bc

My code for barcode

window.DatecsPrinter.connect(printerAddress, () => { window.DatecsPrinter.printBarcode( 75, //here goes the barcode type code '13132498746313210584982011487', //your barcode data () => { alert('success!'); }, (error) => { alert(JSON.stringify(error)); } ); }, (err) => alert('err: ' + JSON.stringify(err)));

Thanks!

csleeds commented 5 years ago

For image printing, i do face the same issue like this before, there is a workaround for that but i'm not sure if it will works all the time as i believe the core issue is due to unsupported/ partially supported printer model.

Try trigger a text print before you print an image: window.DatecsPrinter.printText("{br}", 'UTF-8', function () { window.DatecsPrinter.printImage( printData, 200, 200, 1, function () { }, function (error) { alert(JSON.stringify(error)); } ); }, function (error) { alert(JSON.stringify(error)); } );

Let me know if this works for you too.