Summary

Recently I have deployed HomeBox to my cluster. Homebox is a fairly nifty program for home inventory management. One feature of it that I like in particular is the ability to print QR codes for items and locations. This “quickbit” isn’t intended to go over Homebox itself but its worth mentioning as it seems like a useful tool and spurred this need. One problem is that HomeBox can’t directly print to any printer, you need to download the QR code and print it yourself. This has been stated in other posts but I simply do not use Windows and this means more obsurce things like label printing support is limited. Thankfully I found brother_ql and this allows you to print jpegs to your printer. Below are some sample commands for printing said jpegs.

Samples

DK-2251:

BROTHER_QL_PRINTER=tcp://10.0.5.31 BROTHER_QL_MODEL=QL-810W brother_ql print --red -l 62 -d ./qrcode.jpg

NOTE:
The command above wil not print in red, but you need to include the --red as DK-2251 is a black/red tape.

DK-2205:
The DK-2205 tape is the same as 2251 but lacks printing in red, as such you only need to drop the --red flag.

BROTHER_QL_PRINTER=tcp://10.0.5.31 BROTHER_QL_MODEL=QL-810W brother_ql print -l 62 -d ./qrcode.jpg

NOTE:
I have noticed the red tape has some red even in all black prints, this creates an odd shadow effect. The 2205 tape is significantly cheaper and the quality of the prints is higher, I would opt for this unless you truly need the red tape.

DK-1201:
Sadly, unlike the DK-2251 roll you can’t simply download the images and print them directly. In order for the sample to work you will need to create an image of the exact dimensions. This is much harder than it would seem when done in LibreOffice as the dimensions in the page layout seems to have 0 correlation with what the dimensions of the label actually are.
If you would like to use LibreOffice you will need to set the page dimensions by going to Format -> Page Style then adjust the height and width.
For Landscape:

  • Height: 10.31"
  • Width: 3.18"

For Portrait:

  • Height: 3.18"
  • Width: 10.31"

Then export your document as a jpeg, you can now print said jpeg with the command below. Exactly how 3.18" x 10.31 comes out to 29mm x 90mm is beyond me, but it works.

BROTHER_QL_PRINTER=tcp://10.0.5.31 BROTHER_QL_MODEL=QL-810W brother_ql print -l 29x90 -d ./qrcode.jpg

NOTE:
If this is something you intend on doing often, it would be worth wile saving these formatted examples as templates for the future.

A simple workflow

When first getting things setup you may need to print a LOT of QR codes. The default workflow is to:

  1. Create your item in the WebUI
  2. Download the QR code
  3. Print code from the CLI

This is simple enough but I can be forgetful so one concern I had was that I might re-print the same QR code and slap it on a new item. To get around this I use inotifywait, by using inotify with close_write I force my self to have to overwrite the currently downloaded QR code, then inotify will trigger the print command. This means the printer will not print the same QR code twice effectively preventing me from accidently printing the same image twice.

while inotifywait -e close_write ./qrcode.jpg; do BROTHER_QL_PRINTER=tcp://10.0.5.31 BROTHER_QL_MODEL=QL-810W brother_ql print --red -l 62 -d ./qrcode.jpg; done