To print any document, the following steps are required:
- Click the “print” icon. This opens the print view where you can select the print format, etc
- Click the “Print” button. This opens the browser’s print windows (after a while) where you can select the printer, etc
- Click the “Print” button in browser’s print windows
That is, at least 3 click as required to print any document. This is a pain for many users, especially those who have many printers/print formats.
For example, in the case of a restaurant, there are two printers, one thermal printer for kitchen and another for invoices printing. Each printer needs specific print format. So, in addition to the above steps, the user has to select the print format and then the desired printer. This makes a a total of almost 7 clicks! In this scenario, the printing process is a real pain for users.
The printing process needs to be simplified. Ideally, users have to make just 1 click.
How to make Silent Print
Webapp have their limit when it comes to manipulate user’s hardware (e.i. printer), for security reasons. The only available option browsers give is to print directly, that is, the print windows is not open. In Chrome there is a
--kios-printing flag and in Firefox there is a
However, this has it limit. You can’t select the printer you want to send to (at least in a easy way). How to overcome this limit? Well, I came across this tool called Webapp Hardware Bridge. It is basically a Java program that acts as a bridge between the webapp and hardware (printers and serial ports), accepting websocket request. It comes with a configurator in which you can specify which printer will be used according to which label (Print Type) is received (see image).
So, the webapp has to connect to the websocket server (bridge), send a request specifing the label (Print Type) and the bridge sends the order to the printer automatically. That is, it could be done in just 1 click!
I already used this tool to print silently, in a scenario in which there are two printers and two respective print formats. The tool works well. However, the code needs some adjustments to cover more scenarios.
I want to contribute this feature to frappe. In order to make the code more general (configurable), I plan to:
- Add some fields in Print Format doctype in which specify the labels and the paper size (even witch custom size)
- In the print view of any document, include a button to “Print Silently” (which will create a PDF, convert it to base64 and sent it to the bridge throught websocket).
I would like to know what do you think.