receipt-print-hq / chrome-raw-print

Chrome app to enable raw printing from a browser
MIT License
64 stars 22 forks source link
chrome chrome-extension cloud pos printer printing receipt usb-receipt-printers

Raw printing for Chrome

Chrome Apps are being discontinued by Google in 2018, so this project will no longer be actively developed. At the time of writing, neither WebUSB nor raw sockets can be used from regular web pages, so you will need to transition to a native app for this functionality once the runtime becomes unavailable.

Thank you to everybody who has used or contributed to this app over the past year and a half!


This is a Chrome app to allow browser-based Javascript code to pass raw data to a supported printer. It is aimed at developers of web-based point-of-sale systems where server-side printing is not feasable.

This has been developed for use with a USB receipt printer, with an ESC/POS command generator (escpos-php) providing the binary data.

The problem

It can be difficult to add printing to a web-based point-of-sale system:

This app solves the problem by exposing a websocket on localhost. A web-page can then retrieve binary print data from the server, and pass it to the app for printing.

Compatibility

Printer types

Only USB receipt printers are currently supported.

Supported printers

Raw printing for Chrome is loaded with vendor/product ID's for the following printers:

If your USB printer is not listed, please create a new issue to request support. Because of the way Chrome app permissions work, please include the USB vendor ID and product ID.

Page Description Languages

This app is simply a connector. In theory, any page description language is supported, provided that you are able to generate it, and your printer can understand it.

Installation

This application is not yet available in the Chrome store, so the installation steps are a bit unusual:

screenshot

Demo

A small example web-page available under example/, which will print a "Hello World" receipt in ESC/POS if the raw printing app is running, with an ESC/POS printer configured. Steps to try it out:

This was tested on an Epson TM-T20.

Build

yarn
gulp

The chrome-raw-print subfolder contains the compiled files.

Contribute

Pull requests are welcome and appreciated. This project is quite new, please see the issue tracker for ideas of things to work on.

Screenshot

screenshot