Print image using Bluetooth Serial Plugin

wow! what kind of printer are you using? it it because it does not compatible with my printer?

It is GOOJPRT MTP-3 Bluetooth Thermal Printer. But I think it is not because your printer is not compatible, I can actually see other devices even if it is not a printer. I tried replicating your error and it is actually you are running it in the browser.

You can try running “ionic cordova run android” to make it work on your device

21%20PM
i already run on my device and already connect printer bluetooth with my device… but still dont get it… can you share how you install the plugin ?

I only run the following command

ionic cordova plugin add https://github.com/giorgiofellipe/cordova-plugin-datecs-printer.git

can you share your ionic info?

My ionic info

1 Like

thank you…can you share your minimum sdk in config.xml

The minimum sdk is 19.

@test-nikko thank you so much! i already manage to connect it… what i did was i make sure my ionic info is the same as yours.

1 Like

is this the correct way to print image? because the image is not printed as a picture… did i miss something here?

printMyImage() {

		var image = new Image();
    image.crossOrigin='Anonymous';
		image.src = 'assets/imgs/d.jpeg';
		image.onload = function() {

    var canvas = document.createElement('canvas');
    console.log(canvas);
    canvas.width=image.width;
    canvas.height=image.height;
		var context = canvas.getContext('2d');
		context.drawImage(image,0, 0);
		var imageData = canvas.toDataURL('assets/imgs/d.jpeg').replace(/^data:image\/(png|jpg|jpeg);base64,/, ""); //remove mimetype
    console.log(imageData);
		window.DatecsPrinter.printImage(
			imageData, //base64
			canvas.width,
			canvas.height,
			1,
		function(success) {
			alert(JSON.stringify(success));
			// this.printQRcode();
			// this.provideFeed();
			},
		function(error) {
			  alert(JSON.stringify(error));
			}
		)};
}

test-nikko
Thanks a lot & happy new year,

Do you know how to use the cut paper function for the pos printer ?

I have the same error, have you fixed it yet.
please help me !!!

sorry for late reply… i managed to fix this problem by making my ionic info is the same as this one…Print image using Bluetooth Serial Plugin and dont forget to run the project in actual device.

thanks U. i using the plugin DatecsPrinter and its run very good in android.
But its not run in IOS.How to print image in IOS ???

oh i never try on ios…

oke Thanks U.if U have information of print image in ios .Please contact me !!!

okayy sure… welcomee…

1 Like

hello im getting eror after adding plugin DatecsPrinter and my project on android.
this my eror .gradle\caches\transforms-1\files-1.1\support-compat-28.0.0.aar\2cd26750c9eeb66f6e555fb53f2ba7b9\res\values\values.xml:133:5-70: AAPT: error: resource android:attr/fontVariationSettings not found.
can someone share sample app using this plugin DatecsPrinter in ionic 3 , thanks…

How to print QR code at bluetoothSerial.write(data), please you have any solutions.

Hai, I changed Image to base64 and print this.BluetoothSerial.write(data) it is not printing the image.


It is print the data like this, Please help me.