File: ean13s.pl

package info (click to toggle)
libpostscriptbarcode 20200401-1.1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 3,920 kB
  • sloc: ansic: 563; makefile: 304; perl: 277; xml: 243; sh: 107; lisp: 92; java: 73; python: 45; ruby: 21
file content (29 lines) | stat: -rw-r--r-- 602 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/perl -w
use strict;

die 'Requires two arguments' if (@ARGV!=2);

open(PS,'barcode.ps') || die 'File not found';
$_=join('',<PS>);
close(PS);

print "%!PS-Adobe-2.0\n";

m/
    %\ --BEGIN\ TEMPLATE--
    (.*)
    %\ --END\ TEMPLATE--
    /sx || die 'Unable to parse out the template';
print $1;

for (my $i=$ARGV[0], my $j=0; $i<$ARGV[1]; $i++, $j++) {
    my $x=100+150*(int($j/7));
    my $y=100+100*($j%7);
    print "gsave\n";
    print "$x $y moveto\n";
    print "($i) (includetext) /ean13 /uk.co.terryburton.bwipp findresource exec\n";
    print "grestore\n";
}

print "showpage\n";