diff options
-rwxr-xr-x | pdftool.pl | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/pdftool.pl b/pdftool.pl new file mode 100755 index 0000000..269825d --- /dev/null +++ b/pdftool.pl @@ -0,0 +1,49 @@ +#! /usr/bin/perl + +use Getopt::Long; +use warnings; +use strict; + +Getopt::Long::Configure ("bundling"); + +my $remote = 'graal'; + +my $pdf2ps = 'pdftops'; +my $ps2pdf = 'ps2pdf'; +my $pscrop = 'psnup2.pl -s1 -l1'; +my $psnup = 'psnup'; +my $psbook = 'psbook'; +my ($zip,$zcat) = ('bzip2','bzcat'); + +open(PAPERSIZE, "/etc/papersize") + or die "Couldn't read `/etc/papersize'"; +my $papersize = <PAPERSIZE>; +chomp $papersize + or die "Couldn't read papersize"; +close PAPERSIZE; + + +my $nup = 1; +my $margin = 1; +#TODO: units +my $crop; +my $book; + +GetOptions( "nup|n=i" => \$nup, + "1" => sub { $nup = 1 }, + "2" => sub { $nup = 2 }, + "4" => sub { $nup = 4 }, + "8" => sub { $nup = 8 }, + "crop|c" => \$crop, + "book|b" => \$book, + "margin|m=s" => \$margin ); + + +for (my $n = $nup; $n > 1; $n /= 2) { + die "nup should be a power of two" + unless $n % 2 == 0; +} + + +print $nup, "\n"; + |