diff options
author | Guilhem Moulin <guilhem.moulin@chalmers.se> | 2010-09-26 14:38:37 +0200 |
---|---|---|
committer | Guilhem Moulin <guilhem.moulin@chalmers.se> | 2010-09-26 14:39:27 +0200 |
commit | 019b9f1d113475708de93e338d876ff7a090254f (patch) | |
tree | ba263e7f3b590e51e61bec3b5ba029aaa0f99e43 | |
parent | b72e0359e2015f2beef8364ca6513c9d186a0254 (diff) |
Typos; didn't manage to avoid the creation of auxiliary files :(
-rwxr-xr-x | pdftool.pl | 12 | ||||
-rwxr-xr-x | psresize2.pl | 30 |
2 files changed, 29 insertions, 13 deletions
@@ -1,7 +1,8 @@ #! /usr/bin/perl -w -use Getopt::Long qw(:config posix_default no_ignore_case bundling); +use Getopt::Long qw(:config posix_default no_ignore_case gnu_compat + bundling auto_version auto_help); use Pod::Usage; use IPC::Open2; use POSIX qw(floor); @@ -46,6 +47,10 @@ option suppresses this. Display a brief help. +=item B<--version> + +Display the version number of the I<PDFTool> program. + =item B<--man> Display the manual page. @@ -83,9 +88,7 @@ my $book; my $nup = 1; my $quiet; my $man; -my $help; -# TODO: select pages # TODO: choose the output type GetOptions( "select|s=s" => \$select, "paper|p=s" => \$paper, @@ -103,11 +106,10 @@ GetOptions( "select|s=s" => \$select, "8" => sub { $nup = 8 }, "9" => sub { $nup = 9 }, "q|quiet" => \$quiet, - "help" => \$help, "man" => \$man ) or pod2usage(2); -pod2usage(1) if (defined $help or $#ARGV > 1); +pod2usage(2) if ($#ARGV > 1); pod2usage(-exitstatus => 0, -verbose => 2) if defined $man; # Input and output files diff --git a/psresize2.pl b/psresize2.pl index 8045771..7224a82 100755 --- a/psresize2.pl +++ b/psresize2.pl @@ -1,11 +1,12 @@ #!/usr/bin/perl -w -use Getopt::Long qw(:config posix_default no_ignore_case bundling); +use Getopt::Long qw(:config posix_default no_ignore_case gnu_compat + bundling auto_version auto_help); use Pod::Usage; use IPC::Open2; use IPC::Open3; -use POSIX qw(floor mkfifo); +use POSIX qw(floor); use strict; @@ -86,16 +87,27 @@ demanding for the CPU. I<PSResize2> normally prints the page numbers of the pages output; this option suppresses this. -=item B<--help> +=item B<-?,--help> Display a brief help. +=item B<--version> + +Display the version number of the I<PSResize2> program. + =item B<--man> Display the manual page. =back +=head1 EXAMPLES + +The following comand can be used to remotely crop a PDF file, and +convert it to A4 paper + +pdftops in.pdf - | ssh remote psresize2.pl -cpA4 | ps2pdf - out.pdf + =head1 REQUIRE Requires psutils installed and available in the command line @@ -113,6 +125,8 @@ Version: 0.1, 25 September 2010 =cut +# TODO: inline it in the header +$main::VERSION = "0.1, 25 September 2010"; my $tmpdir = "/tmp"; @@ -126,7 +140,6 @@ my $crop; my $rotdir = 'L'; my $quiet; my $man; -my $help; # TODO: "-m h1cm:v3cm": horizontal, vertical GetOptions( "w|width=s" => \$outwidth, @@ -139,11 +152,10 @@ GetOptions( "w|width=s" => \$outwidth, "m|margin=s" => \$margin, "c|crop" => \$crop, "q|quiet" => \$quiet, - "help" => \$help, "man" => \$man ) or pod2usage(2); -pod2usage(1) if (defined $help or $#ARGV > 1); +pod2usage(2) if ($#ARGV > 1); pod2usage(-exitstatus => 0, -verbose => 2) if defined $man; # Input and output files @@ -272,8 +284,9 @@ if (defined $crop) { last; } } - die "Cannot guess input page size!" unless @bbox; - seek FIN, 0, 0 or die "$!"; + die "Cannot guess input page size!" unless @bbox; + + seek FIN, 0, 0 or die "$!"; } @@ -447,6 +460,7 @@ sub topoints { # sub papersize { my ($p,$w,$h) = @_; + $p = lc $p; if ($p eq "a0") { ($$w,$$h) = ("841mm", "1189mm"); |