| 1 | #!/usr/local/bin/perl -w | ||
| 2 | |||
| 3 | # $Id: bingo_print.pl 1835 2007-03-17 17:36:20Z jonasbn $ | ||
| 4 | |||
| 5 | use strict; | ||
| 6 | use PDFLib; | ||
| 7 | use Getopt::Long; | ||
| 8 | use Data::Dumper; | ||
| 9 | use Games::Bingo::Print; | ||
| 10 | |||
| 11 | my ($cards, $help, $heading, $text, $filename, $papersize); | ||
| 12 | |||
| 13 | GetOptions ( | ||
| 14 | 'help' => \$help, | ||
| 15 | 'heading=s' => \$heading, | ||
| 16 | 'text=s' => \$text, | ||
| 17 | 'filename=s' => \$filename, | ||
| 18 | 'cards=i' => \$cards, | ||
| 19 | 'papersize=s' => \$papersize, | ||
| 20 | ); | ||
| 21 | |||
| 22 | my $pages = shift @ARGV || usage(); | ||
| 23 | |||
| 24 | my $bp = Games::Bingo::Print->new( | ||
| 25 | 'heading' => $heading, | ||
| 26 | 'text' => $text, | ||
| 27 | 'filename' => $filename, | ||
| 28 | 'papersize' => $papersize, | ||
| 29 | ); | ||
| 30 | |||
| 31 | $bp->print_pages($pages, $cards); | ||
| 32 | |||
| 33 | exit(0); | ||
| 34 | |||
| 35 | sub usage { | ||
| 36 | print "Usage: bingo_print.pl [options] <number of pages>\n\n"; | ||
| 37 | print "Options:\n"; | ||
| 38 | print "\t--help\t(this message)\n"; | ||
| 39 | print "\t--heading\ta string which will be inserted as a header\n"; | ||
| 40 | print "\t--text\ta string to be inserted underneath the header\n"; | ||
| 41 | print "\t--filename\ta filename for the PDF target file\n"; | ||
| 42 | print "\t--cards\tthe number of cards per page (1-3, 3 is default)\n"; | ||
| 43 | print "\t--papersize\tthe format of the paper, A4 is default)\n"; | ||
| 44 | |||
| 45 | exit(0); | ||
| 46 | } | ||
| 47 | |||
| 48 | __END__ |