KoblentsBlog Photography
Contact About
Ches
Brother Label Printer From MacOS Command Line
We have some Brother label makers and I wanted to programmatically make one print stuff, from a mac. First, I installed the ptouch drivers from the Brother website. Took ages to fiddle with it just right, but the product is very simple. Here's an example with 12mm wide tape and 12-character-wide printing.
Brother PT 2730:
123
echo "0123456789AB" | \
	lpr -o media=12mm -o PageSize=Custom.30x99 -o page-top=8 \
	-o landscape -P Brother_PT_2730;
Brother PT D600:
123
echo "0123456789AB" | \
	lpr -o media=12mm -o PageSize=Custom.28x93 -o page-top=8 \
	-o landscape -P Brother_PT_D600;
You can see some small differences - details after the jump.
Useful commands:
$ lptoptions [-l]

$ lpstat

$ less /etc/cups/ppd/Brother_PT_D600.ppd
Note that these device use point/unit; you need to figure out physical measurements (mm/inch) to dot conversions. For example, for the D600, we see:
PageSize 3.5mm/0.14": "<</PageSize[10   198]/ImagingBBox null>>setpagedevice"
*PageRegion 12mm/0.47": "<</PageSize[34  198]/ImagingBBox null>>setpagedevice"

So we get 0.35mm per point, and using other measurements offered we know it's about right (eg, 6mm is about 17 dots, 9mm is about 26 dots, 12mm is 34 dots, etc.)
Note that by default, this is 10 dots wide and 198 dots long, so we need to change the printer to print in landscape mode.
Next up, we can see the margins set up:
*ImageableArea 12mm/0.47":    "3 6 31 192"

The margin format is " ", which - if I am doing my math right - tells me that printing in landscape mode, we get a 3-dot margin on the top and bottom (31 is 3 less than 34), and a 6 dot margin on the right and left.
By default, the column width is set to ten characters per inch (72 or ~72.5 points). Twelve characters makes about 87 points, plus 6 for the margins makes 93. Row height allows for (default) six rows per inch, or about 12 points per character; to center in the 28 available points, we should set a top-margin of (28/2 - 12/2 = 14-6 = 8). Roughly.
All of these are things you'll probably want to tune to perfection.
Ches Koblents
July 10, 2019
 
« Newer Older »
© Copyright Koblents.com, 2012-2024