[ic] Linux label printers

Grant emailgrant at gmail.com
Tue Jan 18 20:17:00 EST 2005


> Just about any thermal label printer will work with Linux.  We use
> serveral old RJS barcode printers.  A few Printronix barcode printers and
> over a dozen zebra printers.  There are really 2 issues that need to be
> addressed.  The first issue is simply getting over the connectivity hump.
> If you are using a serial connection, the baud rate, parity, and handshake
> issues must all match.
> 
> Once this is done, the next step is to look at the programmers guide for
> the appropriate printer.  For example to print hello world on a zebra
> printer you need something like this:
> A30,50,0,3,1,1,N,"Hello World"^M
> The first byte tells the printer to use straight alpha.  The remaining
> bytes up the the first comma provide the horizontal print position.  The
> 50 after the first comma is the vertical print position (in dot rows, I
> think).  The next commas  separated byte is the orientation (upside down,
> vertical, etc), the next comma separted byte is font size, etc.  The last
>   element is the actual text to be printed in quotes.
> 
> Here is a sample output to print a complete UPS Next Day air label.  The
> lower case "b" and the characters that follow generate the 2D barcode.
> The lines that start with an uppercase "B" generate a conventional
> barcode.
> 
> M135,2,100^M
> I8,0,001^M
> N^M
> R5,10^M
> S4^M
> D15^M
[snip]
> A30,1044,0,3,1,1,N,"ORDER NUMBER 2006"^M
> A30,1066,0,3,1,1,N," P.O. NUMBER 3343844-1"^M
> A598,1179,0,2,1,1,N,"URC 08/2001"^M
> 
> Bruce

Thanks Bruce.  What about printing a digital TIF?  I could also
convert it to another format.  I've got a perl script that does cause
my lp0 laser printer to warm up, but it doesn't print.

open (LABEL, "label.tif") or die "Could not open the label file. $!";
open (PRINTER, ">/dev/usb/lp0") or die "Could not open the printer. $!";
my $line = '';
$line = <LABEL>;
while ($line) {
print PRINTER $line;
$line = <LABEL>;
}
close(LABEL);
close(PRINTER);

I run it like 'perl print_script'.  What am I missing?

- Grant


More information about the interchange-users mailing list