drffej / webusb.printer

Webusb Thermal Printer demo
38 stars 22 forks source link

Print images maybe? #3

Open fernandosada opened 4 years ago

fernandosada commented 4 years ago

Hi! thank you for this code, i managed to get it to work in android browser via usb cable to an android tv box. I have struggle to get an image print, do you manage to get it to work with images? i tried converting img to base64, then to hex, then byte arrays, all without success :/

Gili60 commented 7 months ago

Hi, were you able to print images using WebUSB API? I have an AngularJS app, I was able to print text to EPSON printer, however, I can not get image printing to work. Any ideas what to do?

drffej commented 7 months ago

You have to communicate with the device using the EPSON ASCII print language. This article should help - https://www.visuality.pl/posts/webusb-print-image-and-text-in-thermal-printers

fernandosada commented 7 months ago

In my case, I ended up using an android app called "RawBT", which you can use to print in android with thermal printers. The idea is that you send the image via Javascript to the RawBT app, and the app handles the printing.

Gili60 commented 7 months ago

Thanks for the replies. Due to the nature of my app I have to use WebUSB API for the printing. I tried printing images with ESC/POS commands but with no lock. For now, I can not use any package typescript-based.

Regarding the article- https://www.visuality.pl/posts/webusb-print-image-and-text-in-thermal-printers Do you know what is the image parameter that is being sent to the printImage function? what type?

Thanks for all the help.