thiendangit / react-native-thermal-receipt-printer-image-qr

React native thermal receipt printer
https://www.npmjs.com/package/react-native-thermal-receipt-printer-image-qr
112 stars 73 forks source link

BLEPrinter.printImage does not work #6

Closed chukiatt closed 2 years ago

chukiatt commented 2 years ago

i try to print image but it does not print anything

BLEPrinter.printImage("https://sportshub.cbsistatic.com/i/2021/04/09/9df74632-fde2-421e-bc6f-d4bf631bf8e5/one-piece-trafalgar-law-wano-anime-1246430.jpg");

actually i need to print image from dataUri

BLEPrinter.printImage("uri:data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAApgAAAKYB3X3/OAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAANCSURBVEiJtZZPbBtFFMZ/M7ubXdtdb1xSFyeilBapySVU8h8OoFaooFSqiihIVIpQBKci6KEg9Q6H9kovIHoCIVQJJCKE1ENFjnAgcaSGC6rEnxBwA04Tx43t2FnvDAfjkNibxgHxnWb2e/u992bee7tCa00YFsffekFY+nUzFtjW0LrvjRXrCDIAaPLlW0nHL0SsZtVoaF98mLrx3pdhOqLtYPHChahZcYYO7KvPFxvRl5XPp1sN3adWiD1ZAqD6XYK1b/dvE5IWryTt2udLFedwc1+9kLp+vbbpoDh+6TklxBeAi9TL0taeWpdmZzQDry0AcO+jQ12RyohqqoYoo8RDwJrU+qXkjWtfi8Xxt58BdQuwQs9qC/afLwCw8tnQbqYAPsgxE1S6F3EAIXux2oQFKm0ihMsOF71dHYx+f3NND68ghCu1YIoePPQN1pGRABkJ6Bus96CutRZMydTl+TvuiRW1m3n0eDl0vRPcEysqdXn+jsQPsrHMquGeXEaY4Yk4wxWcY5V/9scqOMOVUFthatyTy8QyqwZ+kDURKoMWxNKr2EeqVKcTNOajqKoBgOE28U4tdQl5p5bwCw7BWquaZSzAPlwjlithJtp3pTImSqQRrb2Z8PHGigD4RZuNX6JYj6wj7O4TFLbCO/Mn/m8R+h6rYSUb3ekokRY6f/YukArN979jcW+V/S8g0eT/N3VN3kTqWbQ428m9/8k0P/1aIhF36PccEl6EhOcAUCrXKZXXWS3XKd2vc/TRBG9O5ELC17MmWubD2nKhUKZa26Ba2+D3P+4/MNCFwg59oWVeYhkzgN/JDR8deKBoD7Y+ljEjGZ0sosXVTvbc6RHirr2reNy1OXd6pJsQ+gqjk8VWFYmHrwBzW/n+uMPFiRwHB2I7ih8ciHFxIkd/3Omk5tCDV1t+2nNu5sxxpDFNx+huNhVT3/zMDz8usXC3ddaHBj1GHj/As08fwTS7Kt1HBTmyN29vdwAw+/wbwLVOJ3uAD1wi/dUH7Qei66PfyuRj4Ik9is+hglfbkbfR3cnZm7chlUWLdwmprtCohX4HUtlOcQjLYCu+fzGJH2QRKvP3UNz8bWk1qMxjGTOMThZ3kvgLI5AzFfo379UAAAAASUVORK5CYII=")

could you suggest the right way to solve that

thank you very much

thiendangit commented 2 years ago

@chukiatt What platform are you having problems?

chukiatt commented 2 years ago

I run on android real device .

Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows

From: @.> Sent: 6 ธันวาคม 2564 21:18 To: @.> Cc: @.>; @.> Subject: Re: [thiendangit/react-native-thermal-receipt-printer-image-qr] BLEPrinter.printImage does not work (Issue #6)

@chukiatthttps://github.com/chukiatt What platform are you having problems?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/thiendangit/react-native-thermal-receipt-printer-image-qr/issues/6#issuecomment-986818085, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEEYLIHNX4HVQKN3LD223A3UPTA2XANCNFSM5JOOH5GQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

thiendangit commented 2 years ago

@chukiatt I don't have a bluetooth printer at the moment so I can't develop and test this feature yet! but I'll try to find a way to guide you through its development and testing.!

thiendangit commented 2 years ago

@chukiatt if you only develop print feature for android and bluetooth you can try using this library: https://www.npmjs.com/package/react-native-thermal-printer

chukiatt commented 2 years ago

I already use your suggested library https://www.npmjs.com/package/react-native-thermal-printer . but it can not print qrcode and image. Until I found the library react-native-thermal-receipt-printer-image-qr. I see it can print qrcode and image in your doc.

Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows

From: @.> Sent: 6 ธันวาคม 2564 21:50 To: @.> Cc: @.>; @.> Subject: Re: [thiendangit/react-native-thermal-receipt-printer-image-qr] BLEPrinter.printImage does not work (Issue #6)

@chukiatthttps://github.com/chukiatt if you only develop print feature for android and bluetooth you can try using this library: https://www.npmjs.com/package/react-native-thermal-printer

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/thiendangit/react-native-thermal-receipt-printer-image-qr/issues/6#issuecomment-986845994, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEEYLICT4NKTDG5TG6J5MJLUPTESHANCNFSM5JOOH5GQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

thiendangit commented 2 years ago

@chukiatt I'll try to develop this feature! Can you help me test it because i don't have bluetooth printer?

chukiatt commented 2 years ago

very welcome

Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows

From: @.> Sent: 6 ธันวาคม 2564 21:59 To: @.> Cc: @.>; @.> Subject: Re: [thiendangit/react-native-thermal-receipt-printer-image-qr] BLEPrinter.printImage does not work (Issue #6)

@chukiatthttps://github.com/chukiatt I'll try to develop this feature! Can you help me test it because i don't have bluetooth printer?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/thiendangit/react-native-thermal-receipt-printer-image-qr/issues/6#issuecomment-986854116, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEEYLIHEZ2RPYEJCWSCBVVDUPTFUJANCNFSM5JOOH5GQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

chukiatt commented 2 years ago

very welcome

thank you very much

thiendangit commented 2 years ago

@chukiatt please try again!

chukiatt commented 2 years ago

after update to "react-native-thermal-receipt-printer-image-qr": "^0.1.3", i got this error

TypeError: RNBLEPrinter.printImageData is not a function

thiendangit commented 2 years ago

@chukiatt i added it in v0.1.3 for android version already! try to remove yarn.lock and react-native-thermal-receipt-printer-image-qr in your node_modules and try again!

chukiatt commented 2 years ago

@thiendangit i will try again and response to inform you

chukiatt commented 2 years ago

@thiendangit i make sure by created a new react native app for test and then install only your library

npx react-native init testProject npm install react-native-thermal-receipt-printer-image-qr
react-native run-android --deviceId=SWTOAIKNM78TCYSW

app build success. but printImage is still error

TypeError: RNBLEPrinter.printImageData is not a function. (In 'RNBLEPrinter.printImageData(imgUrl, function (error) { return console.warn(error); })', 'RNBLEPrinter.printImageData' is undefined)

thiendangit commented 2 years ago

@chukiatt Ahhh sr. i see this error! I’ll fix it in the morning.

chukiatt commented 2 years ago

Thank you very much

thiendangit commented 2 years ago

@chukiatt i fixed in v0.1.4

chukiatt commented 2 years ago

@thiendangit It's work. I am very glad

i not sure it's support both Android and iOS ?

Thank you very much

thiendangit commented 2 years ago

@chukiatt Does Android work? if you want to print pictures with bluetooth in ios or with base64 uri, I can help you!

chukiatt commented 2 years ago

@thiendangit Yes, i want to print in both platform include base64 uri

my goal is draw everything to image (text and picture) and export to base64 toDataURL() to print. this idea is pretty good for almost printer can print without a problem (not only epson and star)

thanks for your help

thiendangit commented 2 years ago

@chukiatt ok i'll try it tonight 😁

thiendangit commented 2 years ago

@chukiatt please try :

react-native-thermal-receipt-printer-image-qr : "https://github.com/thiendangit/react-native-thermal-receipt-printer-image-qr.git"

chukiatt commented 2 years ago

@thiendangit

Thank you for your help. Your library will be an important part of the build POS project. of Thailand

Thank you very much

thiendangit commented 2 years ago

@chukiatt is print BLUETOOTH working? if it working, i'll release new version!

chukiatt commented 2 years ago

Yes, now i tested only bluetooth, It's work well.

thiendangit commented 2 years ago

@chukiatt wow! many tks :tada:. Both android and ios are ok? ? give me star if you like my repos :kissing_closed_eyes: :kissing_closed_eyes:

thecodecafe commented 2 years ago

Hi @thiendangit, this is a great library, I just tried BLEPrinter.printQrCode(base64EncodedImage) and got an error saying printQrCode is not a function in RNBLEPrinter.printQrCode(qrCodeBas64, function(error) {return console.warn(error);}) RNBLEPrinter.printQrCode is undefined. I've given a star! 😊

[Edit] This is happening on Android, this is the only platform I can test for right now. The problem was that in RNBLEPrinter the printQrCode method does not have @ReactMethod so it's not exported in NativeModules.

thiendangit commented 2 years ago

@thecodecafe many tks! I was careless