Print receipts via thermal printer

Hi there,

maybe anybody had the same problem I am facing to right now.
I want to print receipts via thermal printer. I did a bit of resaerch and there are multible options on printing from a web app.

Option 1 is printing with a cloud based print server like google cloud print or ezeep. Google cloud print gets his shutdown in the end of this year. I had a call with the ezeep support about this topic. They see some major problems on facing the right drivers for thermal printers. At least I have a thermal printer next to me, so I am able to test a little bit on the ezeep solution.

Option 2 is printing via the web browser itself. I found this forum post about printing labels, but i think I don’t understand the solution correctly.
I also found an Browser Addon for printing to thermal printers with web apps. QZ-Tray Here I have the problem to get the necessary js-code to the vaadin implementation.

As you see I have a lot of options with a lot of questionmarks in each of them. Maybe some of you solved this problem in a convinient way and want to share his/her solution. :slight_smile:

Cheers

Nico

Hi,

in order to help you, it would be good if you can describe your context:

  • are you controlling the clients in the sense that you can install software on it?
  • are those clients in the same network and potentially the printer is connected via a print server?
  • is the web app served by the public internet?
  • are you fine with having the browser print dialog via a PDF or is it not sufficient for your use-case?

Cheers
Mario

Hi Mario,

thanks for your reply.

Here you find the answers to your questions:

  • the clients are under my control. So its possible to change the software and its even posible to change the hardware and os.
  • The clients are in the same network. But I think there is only one client for printing via a thermal printer. So there is no print server needed for this use case.
  • The web app is served by public internet
  • Its a better user experience to not have the print dialog in this case. But it is not a show stopper.

Cheers
Nico

Nico,

I had a similar problem with Zebra printers. Is this your case ?

Alejandro

1 Like

Hi Alejandro,

yes this is exactly my case. Could you share your solution please? That would be great!

Cheers
Nico

Nico,

First of all, this solution applies only if your printer has an ethernet port. My solution was to write a small program that runs on the user’s PC. It receives an http post with the ZPL string and forward it to the printer to TCP port 9100.

On the CUBA side, you have 3 things to do:

  1. create the javascript function
  2. create the Java class that extends AbstractJavaScriptExtension
  3. On your screen init, wire the action button to the java class:

com.vaadin.ui.Button vButton = printLabelBtn.unwrap(com.vaadin.ui.Button.class);
browserPrinterExtension=new BrowserPrinterExtension();
browserPrinterExtension.extend(vButton,β€œβ€,β€œβ€, β€œβ€);

  1. and the last step, call your new function with the ZPL string as a parameter. It will invoke the javascript function with the zpl, then you repost it to the local forwarding program on your LAN.

Another IT-based option: build a tunnel between your LAN and the internet-based CUBA server with ngrok https://ngrok.com/ . You print to an ngrok port and it forwards to the LAN printer.