I recently setup a label printer where the labels get printed from a full page app to a Brother label printer that takes rolls of 62mm wide and 30 meters long. The printer cuts after each page break. It's a regular usb printer but with a funny page size. Also, Brother's website for finding the mac drivers is a bit of a maze of misdirection that tries to get you to install their extremely shitty application. In the end I found a 3rd party website with a working printer driver for this thing.
After a bit of tinkering, I was able to print 6.2x12.4cm labels with a QR code. Really fun to watch it spit out these stickers. Each sticker has a unique QR code with the printed code in text form below it.
Some gotchas:
- you have to use margin 0 to hide the ugly browser headers that get added in the margin otherwise.
- Firefox has no print preview. This makes testing a bit hard. I used Chrome for testing this in the end.
- To print, you replace the dom tree with your print page, invoke print, and then copy back the app's root node from javascript. This is ugly as it shows the print page below your print dialog while that is open. I've not found a better way to do this. I guess I can do some non page layout that shows while that happens. Hacky but it works.
- I've yet to make this work in landscape mode where the page is vertical 62x31 layout to print small stickers.
The rest is just usual html layout. I used a simple flex row with two elements. Print quality is surprisingly good. Cost per sticker is around 0.3 cents per sticker. Amazing value.
> Brother's website for finding the mac drivers is a bit of a maze of misdirection that tries to get you to install their extremely shitty application.
That seems surprising, considering how no-muss no-fuss their hardware & cartridges are. (As compared to, say, H-P.)
They should just publish technical information and let the Linux community make the software for them. All hardware companies should work like this. The results will be much better than their shitty "cost center" approach to software.
After a bit of tinkering, I was able to print 6.2x12.4cm labels with a QR code. Really fun to watch it spit out these stickers. Each sticker has a unique QR code with the printed code in text form below it.
Some gotchas:
- you have to use margin 0 to hide the ugly browser headers that get added in the margin otherwise.
- Firefox has no print preview. This makes testing a bit hard. I used Chrome for testing this in the end.
- To print, you replace the dom tree with your print page, invoke print, and then copy back the app's root node from javascript. This is ugly as it shows the print page below your print dialog while that is open. I've not found a better way to do this. I guess I can do some non page layout that shows while that happens. Hacky but it works.
- I've yet to make this work in landscape mode where the page is vertical 62x31 layout to print small stickers.
The rest is just usual html layout. I used a simple flex row with two elements. Print quality is surprisingly good. Cost per sticker is around 0.3 cents per sticker. Amazing value.