So, not long into the problem and we have our first problem.
The issue is how we print and open the till drawer.By default the till drawer does not open when you print something. There seems to be no way of altering the preferences to open till drawer by default.
There’s also another little niggle in that there seems to be no way of bypassing the print dialog box when printing, which will become awkward for the staff, I think.
Luckily there is a solution out there – CUPS
CUPS (Common Unix Printing System) is the software on a mac that ‘talks’ to the printer.
The bonus is we can pass hidden options to the printer via the command line (or exec in PHP). The downside is we are going to need a physical file to print out, but let’s think about that in a second. First off, we can get CUPS up and running and opening the till drawer. Without that, the project is dead in the water.
In terminal I type what is recommended by the Star manual:
$ lpr -P "Star_TSP143__STR_T_001_" -o "Presenter Timeout"=1OpenDrawer1 c_hellokitty004.gif
But this does nothing.
Thankfully, I am able to dig about in my printer plist files and pull a result out of the bag:
$ lpr -P "Star_TSP143__STR_T_001_" -o "CashDrawerSetting"=1OpenDrawer1 -o PeripheralSetting=1Activate c_hellokitty004.gif
Which gives us a thermal print of the big headed japanese kitten
Next step is to work out how to create physical files from HTML (presumably PDFs) and print barcodes without any external libraries or software…