6 use CGI::Carp qw(fatalsToBrowser);
11 my $size = $q->param('size') || '105x40';
12 my $width = $q->param('width') || 832;
14 my $print = $q->param('print') || die "no print?";
16 my $ip = $q->remote_addr;
17 my $dir = '/srv/Printer-Zebra';
19 my ( $barcode, $call1, $call2, $call3, $call4 ) = split(/\s+/, $print, 5);
21 my $tmp = '/tmp/zebra';
22 mkdir $tmp unless -e $tmp;
24 open(my $from, '<', "$dir/templates/$size.svg");
25 open(my $to, '|-', "rsvg-convert --width=$width --format=png --background-color=white | tee $tmp/$barcode.png | pngtopnm > $tmp/$barcode.pnm");
27 no warnings 'uninitialized';
28 s/1301272944/$barcode/gs && warn "# barcode $barcode\n";
29 s/##call1##/$call1/gs && warn "# 1: $call1\n";
30 s/##call2##/$call2/gs && warn "# 2: $call2\n";
31 s/##call3##/$call3/gs && warn "# 3: $call3\n";
32 s/##call4##/$call4/gs && warn "# 4: $call4\n";
39 system "./pbm2ZPL.pl $tmp/$barcode.pnm | rlpr --printhost=$ip --printer=zpl --windows --verbose";
41 if ( my $return = $q->param('return') ) {
42 print $q->redirect( $q->param('return') . '&station=' . $ip );
44 print "Content-type: image/png\r\n\r\n";
46 open(my $fh, '<', "$tmp/$barcode.png");