User Tools

Site Tools


scripts:perl:makelto4labels.pl
makeLTO4Labels.pl
#!/usr/bin/perl
 
$LABEL_PRINTER='INV_1x4_IT_1';
$PREFIX='DAILY';
$FIRST_NUMBER = 1;
$LAST_NUMBER = 5;
$SUFFIX = 'L5';
 
$single_print_job = '';
 
$label_template = join('', <DATA>);
 
for ($num = $FIRST_NUMBER; $num <= $LAST_NUMBER; $num++) {
 
	$formatted_label = sprintf($label_template, $PREFIX, $num, $SUFFIX, $PREFIX, $num, $SUFFIX);
	$single_print_job .= $formatted_label;
 
}
 
open(PRINTER, "| lp -d $LABEL_PRINTER") or die "Cannot open printer. $!";
print PRINTER $single_print_job;
close(PRINTER);
 
__DATA__
^XA
^SZ2^JMA
^MCY^PMN
^PW812~JSN
^JZY
^LH0,0^LRN
^XZ
^XA
^FO70,41
^BY3,2.7^B3N,N,80,N,Y^FD%s%03d%s^FS
^FT213,37
^CI0
^A0N,28,39^FD%s%03d%s^FS
^PQ1,0,1,Y
^XZ
/var/www/vhost/www.fuhell.com/data/pages/scripts/perl/makelto4labels.pl.txt · Last modified: 2014/09/01 15:00 (external edit)