#!/usr/bin/perl # # Author: John F. Stoffel # Date: 3/3/1998 # Version: 1.0 # # This code was taken from Jeff Jewett and # beaten with a stick to make it sorta work on an ATL 7100 jukebox. # Which is also a SUN ETL 7/3500 jukebox as well. I followed the ATL # spec, but on plain laser paper it's not quite good enough. # # Blame me, not Jeff, for what is here. $boxheight = 59; # 0.82 inches $boxwidth = 158; # 2.2 inches $boxseparation = 0;#9; # 0.125 inches $topmargin = 774; # 0.25 inches from the top $leftmargin = 18; # 0.25 inches from the left edge $page = 1; print "\nEnter name of output file: "; chop($file = ); print "\n"; open(OUT,"> $file") || die "Can't create the file $file: $!\n"; &code39; $more = 1; while ($more) { do { print "Enter three letter part of label: "; chop($let = ); $let =~ tr/[a-z]/[A-Z]/; print "Enter starting number: "; chop($start = ); print "Enter ending number: "; chop($end = ); print "The labels you chose will be in the range of\n\n"; printf (" %3s%03d - %3s%03d\n\n",$let,$start,$let,$end); do { print "Is this correct? [Y/n] "; chop ($ans = ); } until ($ans =~ m/^$|$y|$n/i); } until ($ans =~ m/^$|$y/i); for ($x = $start; $x <= $end; $x++) { $la = sprintf("%3s%03d",$let,$x); push @l, $la; } do { print "\nEnter more labels? [y/N] "; chop ($ans = ); } until ($ans =~ /^$|^y|^n/i); $more-- if ($ans =~ /^$|^n/); } print "\nCreating Labels...\n"; foreach $label (@l) { if (!$header_printed) { print OUT "%%Page: $page\n"; # was [5 0 0 15 0 0] $width = 4.19; $height = 9; print OUT "/Code39 findfont [$width 0 0 $height 0 0] makefont "; print OUT "3.8 scalefont setfont\n"; $header_printed++; } $boxx1 = $leftmargin + ($boxwidth + $boxseparation) * $column; $boxy1 = $topmargin - ($boxheight + $boxseparation) * $row; $boxx2 = $boxx1 + $boxwidth; $boxy2 = $boxy1 - $boxheight; # Position the barcode, should move labelx according to scaling of font. $labelx = $boxx1 + 13; $labely = $boxy1 - 40; # Draw outline box print OUT "1 setlinewidth\n"; print OUT "newpath $boxx1 $boxy1 moveto $boxx2 $boxy1 lineto\n"; print OUT "$boxx2 $boxy2 lineto $boxx1 $boxy2 lineto closepath stroke\n"; # Draw Horizontal Lines # .03 linewidth print OUT "2.5 setlinewidth\n"; # .06 inch from bottom print OUT "$boxx1 $boxy2 4 add moveto $boxx2 $boxy2 4 add lineto stroke\n"; # .26 inch from top print OUT "$boxx1 $boxy1 19 sub moveto $boxx2 $boxy1 19 sub lineto stroke\n"; # .56 inch from top print OUT "$boxx1 $boxy1 41 sub moveto $boxx2 $boxy1 41 sub lineto stroke\n"; # Draw barcode print OUT "$labelx $labely moveto (*$label*) show\n"; # Save text label to print at end of page. 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 OUT "%%Trailer\n"; print "done\n"; sub endpage() { local ($row, $column); print OUT "/Helvetica findfont 14 scalefont setfont\n"; $row = 0; foreach $label (@labels) { $labelx = $leftmargin + ($boxwidth + $boxseparation) * $column + 20; $labely = $topmargin - ($boxheight + $boxseparation) * $row - 55 + 40; # show the text label part. print OUT "$labelx $labely moveto { pop pop ( ) show} ($label) kshow\n"; $row++; if ($row > 10) { $column++; $row = 0; } } print OUT "showpage\n"; } sub code39 { print OUT <