#!/usr/bin/perl sub endpage() { local ($row, $column); print "/Helvetica findfont 14 scalefont setfont\n"; $row = 0; foreach $label (@labels) { $labelx = $leftmargin + ($boxwidth + $boxseparation) * $column + 48; $labely = $topmargin - ($boxheight + $boxseparation) * $row - 55; print "$labelx $labely moveto ($label) show\n"; $row++; if ($row > 10) { $column++; $row = 0; } } print "showpage\n"; } system('cat code39.ps'); $boxheight = 59; # 0.82 inches $boxwidth = 158; # 2.2 inches $boxseparation = 9; # 0.125 inches $topmargin = 774; # 0.25 inches from the top $leftmargin = 18; # 0.25 inches from the left edge $page = 1; while () { chop ($label = $_); if (!$header_printed) { print "%%Page: $page\n"; print "/Code39 findfont [5 0 0 15 0 0] makefont "; print "3.8 scalefont setfont\n"; $header_printed++; } $boxx1 = $leftmargin + ($boxwidth + $boxseparation) * $column; $boxy1 = $topmargin - ($boxheight + $boxseparation) * $row; $boxx2 = $boxx1 + $boxwidth; $boxy2 = $boxy1 - $boxheight; $labelx = $boxx1 + 3; $labely = $boxy1 - 40; # Draw outline box print "newpath $boxx1 $boxy1 moveto $boxx2 $boxy1 lineto\n"; print "$boxx2 $boxy2 lineto $boxx1 $boxy2 lineto closepath stroke\n"; # Draw barcode print "$labelx $labely moveto (*$label*) show\n"; push(@labels, $label); $row++; if ($row > 10) { $column++; if ($column > 2) { &endpage(); undef (@labels); $header_printed = $column = 0; $page++; } $row = 0; } } if ($row || $column) { &endpage(); } print "%%Trailer\n";