kilbot / WooCommerce-POS

:bangbang: All development now at https://github.com/wcpos.
http://wcpos.com
GNU General Public License v3.0
353 stars 125 forks source link

Printing from Android Tablet #151

Open frankdieni opened 7 years ago

frankdieni commented 7 years ago

Hi, First I want to say thanks for creating such a great POS plugin for Wordpress. Everything is great except trying to get the receipt printing working. My wife really wants to run her business from a tablet so I purchased a Samsung Android tablet which comes with Chrome and I am having a couple of issues with the printing part.

  1. When you go to print a receipt, it tries to print the actual POS order entry page instead of the actual receipt.
  2. Has anyone connected a USB Star Micronics TSP100 Receipt printer to the tablet via USB OTG or a print server? I have tried Printhand app through USB otg and cant find a suitable driver for it.

I would appreciate any assistance as I am trying to get this going for my wifes newly started business.

Thanking you kindly.

kilbot commented 7 years ago

Hi Frank. If you have a test site you could help test download 0.5.0-beta. This contains some experimental print settings that may help you.

  1. Try the browser/html combination, there have been some improvements to this code which may solve the Android problem.
  2. If that doesn't work, you may be able to send data to a networked print server.
frankdieni commented 7 years ago

Thanks Paul, I would be happy to test out the beta version. I'll keep you updated.

frankdieni commented 7 years ago

Hi Paul, I have tested the Beta on another web server and unfortunately the browser window is still being printed instead of the actual receipt. I have tried multiple devices such as Mobile and tablet and the issue is the same. Do you think you will be able to apply some changes to the code to enable this to work? I would very much appreciate it. For now im testing to use the print to file instead and have this synced to a windows pc which will in turn print the file through a html print software. This is not the ideal way as I need other softwares to sync and print the text file. There is more chance of something breaking this way :) Your help is appreciated,

Frank

kilbot commented 7 years ago

Hi Frank,

I had another look at this on the weekend. It seems there is a bug in Android which prevents printing from an iFrame. The good news is there seems to be some movement on it now, but who knows how long it will take to be available as an update.

The best I could do is open a new tab with the receipt template. You would then have to close the tab after each print.

The other option would be to send the receipt via the network, to the Windows machine, then have a service pick up the data and pass it on the the printer. I'm not sure if there's a Windows print server capable of this or if you would have to code your own solution.

frankdieni commented 7 years ago

Thanks for looking into this, appreciate it. I have a working solution for now so I will be able to wait for Chrome to fix its bugs. I have the Android tablet sync the receipt file orderno.txt to my Windows 7 laptop. I then have a program that automatically renames the receipt.txt to receipt.html as the printer software only prints .html files. Once the file is renamed, the printer software prints the receipt. This all happens within around 10 seconds which is ok for the file to pass through the network & 3 programs :)

It would be even better if I can have the POS send the receipt file as a .html instead of .txt. I have had a look at the plugin files and found the following code in the 4 files below: admin-settings.build.js - ('order_number') + '.txt' app.build.js - ('order_number') + '.txt' admin-settings.min.js - download:this.model.get("order_number")+".txt" app.min.js - download:this.model.get("order_number")+".txt"

If I just rename the part .txt to .html for all 4 files above, will this be ok and wont affect anything else?

Thanks in advance,

Frank app min js admin-settings build js admin-settings min js app build js