October 24, 2020

Koha, Mint 19, and silent printing

The Koha manual describes how to tell Firefox to not display a print dialog box when printing a slip on a receipt printer. But those instructions are specific to Firefox on Windows. I’m in the process of replacing our library’s Windows 7 installations with Linux Mint 19.3, and I found that I I had to do things slightly differently on Linux.

The first step was to install printer drivers. Our library uses an Epson TM-88IV receipt printer. The Linux drivers for this obsolete printer can be found here. After unpacking the file (using tar xvfz), the script must be run as root.

Then the printer needs to have a few things changed in its configuration. Go to Menu / Administration / Printers, then right click over the receipt printer and select Properties. In Job Options, turn off “Scale to fit”. Then under Text Options a bit farther down, set the left, right, and bottom margins to 0. Set the top margin to a small number like 0.1; if it is 0, the top line of a printed receipt might be partially cut off.

Finally, some configuration changes need to be made in Firefox. It’s best to do this in a profile other than the default; refer to this guide to see how to create a separate profile for Koha.

Visit the page about:config, and answer yes to the nagging question about the dangers. In the search box, enter print.always_print_silent. If there is no such preference, create it as a boolean and set it to true. Then enter print.print_margin in the search box, and set all four margins to 0.

Another non-obvious change needs to be made in about:config. Enter printer_printer in the search box. This field should contain the exact name of your receipt printer, as shown in the Printers tool mentioned above. In the case of our Epson printer, I entered Epson-TM-BA-Thermal. Without this change, Firefox printed silently (i.e., without a print dialog) as expected, but it ignored all of the printer configurations, so that the printed slip was scaled so small that it was unreadable.

As a result of all these changes, you should be able to print a slip in Koha without a print dialog, and with no space-wasting margins.

Update 2020-11-03: After updating Firefox to version 82, the printed slips looked wrong again. The margins were back to a half inch, and the print was slightly larger now, so that long lines were cut off on the right. It appears that at some point Firefox created some new configuration values for the Epson printer governing the margins. I found these searching for print_printer_Epson-TM-BA-Thermal in about:config. Among the preferences found with this search string were the following:

  • print_margin_top: I set this to .5, and set the three other print_margin_? preferences to 0.

  • print_unwriteable_margin_?. I set all four of these preferences to 0.