Category Archives: Code

Brother PT-1230PC on Ubuntu Linux

I found one of these in LIDL recently at the kind of price that usually makes me buy gadgets out of curiosity. My wife had been talking about writing out price labels for a stall in our local market for products she has in her web shop. I wondered if this little label printer might make the job easier.

Brother PT-1230PC label printer

Brother supplies no non-Windows drivers for this product. A quick search reveals a neat Glade/Perl application called blabel by Ari Sovij√§rvi that formats two-line labels for the PT-1230PC. I needed to print about 140 price labels, so the several cm feed that seems to be a part of every ‘job’ on this little printer would have wasted some pretty pricey label tape.

Without knowing anything about how the printer is controlled, it seems the best way to avoid the inter-label feeds is to combine several labels into one image and print that aggregate image as a single job. I created a CSV file using phpMyAdmin on the web shop which held the product name and price in two columns. A shell script using ImageMagick converted each line into a single label 120×64 pixels and appended it to an 11-label image, which is then printed as a single job using a ‘–fromfile’ command line argument I added to blabel.

Single 120x64 pixel price label

Single price label

I didn’t do too much trial-and-error on the expensive label tape but the largest image I printed was 1320×64 pixels for 11 labels. I chose 11 because the CSV file had a number of rows divisible by 11. Each label is 120 pixels wide. 20 labels caused the printer’s LED to flash (an error?), so the maximum image is somewhere between 1320 and 2400 pixels wide.

11 labels combined with ImageMagick's convert +append

11 labels with ImageMagick’s convert +append

The original deb from Ari’s site is below, along with a patch that adds the –fromfile command line argument. The image you print must be black and white PNG 64 pixels high. I use it like this:

blabel --fromfile=biglabel.png

blabel with –fromfile patch in zip archive

I’ve never edited Perl before (or code with so many ‘ghetto’ comments =p) so, you know, caveat emptor.