简体   繁体   中英

Send image print command via ESC/POS using JavaScript to thermal printer on ethernet

I have a web application and want to send receipt prints via ESC/POS to a thermal printer on the same ethernet network. Currently, printing text works fine, but I cannot make image printing works using GS V 0 command or ESC *.

Does anybody have a sample JavaScript code that shows how to send image prints to the thermal printer?

If you haven't yet, you may want to check out receiptline : "Transform markdown-like text to receipt printer commands."

I think it does more than you're asking, but I've used it to send images to an Epson TM-L30 printer with success.

Check out the receiptline designer for a working demo. The receiptline format takes a base64 encoded image and converts it to commands to send to the printer.

I use the receiptline npm package directly, but you may be able to peek at the source and extract what you need if you want to do it directly without this library.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM