summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem.moulin@ens-lyon.org>2012-01-08 22:41:27 +0100
committerGuilhem Moulin <guilhem.moulin@ens-lyon.org>2012-01-08 22:41:27 +0100
commitae231eb475a935f53fad77cefe1d79748aa04fc6 (patch)
tree8934774d93de3aaf577b70c47501e86716d7d10f
parentb392143d67e61b45d8fe0b6eb4134e74fe0b17fa (diff)
auto-rotate
-rwxr-xr-xpdftool.pl34
1 files changed, 15 insertions, 19 deletions
diff --git a/pdftool.pl b/pdftool.pl
index f92df3d..25cdfc5 100755
--- a/pdftool.pl
+++ b/pdftool.pl
@@ -28,7 +28,7 @@ pdftool.pl - a swiss army knife for PDF documents
B<pdftool.pl> [B<-w> I<width> ] [B<-h> I<heigth>] [B<-p> I<paper>]
[B<-W> I<width>] [B<-H> I<heigth>] [B<-P> I<paper>] [B<-s> I<pages>]
[B<-m> I<margin>] [B<-b> I<border>] [B<-c>] [B<--book>] [B<--column>]
-[B<-n> I<num>] [B<--no-rotate>] [B<--ps>] [B<-q>] [I<infile> [I<outfile>]]
+[B<-n> I<num>] [B<--auto-rotate>] [B<--ps>] [B<-q>] [I<infile> [I<outfile>]]
=head1 DESCRIPTION
@@ -55,13 +55,6 @@ file name, B<PDFTool> sends the data to the standard output. By
default, B<PDFTool> outputs a PDF document; see B<--ps> to
get a PostScript instead.
-By default, B<PDFTool> rotates the pages in order to ensure that your
-document will always be printable using your favorite duplex mode for portrait
-documents (e.g., Tumble if you prefer to turn the pages like those of a
-book - "vertical folding"; regardless of the orientation of the document).
-See the B<--no-rotate> option to bypass this behavior e.g., to read the
-output document on your screen.
-
B<PDFTool> does the following passes on the input document:
=over 4
@@ -178,12 +171,15 @@ Put multiple logical pages onto each physical sheet of paper.
If I<num> is less than 10, the option B<->I<num> may be used as an
alternative.
-=item B<--no-rotate>
+=item B<--auto-rotate>
-By default, B<PDFTool> ensures that your pdf will be printable using
-your "default" duplex mode (see B<DESCRIPTION>). B<--no-rotate> tries to
-make the output PDF ready to read on your computer instead. It has no
-effect for portrait documents.
+Auto-rotate the pages in order to ensure that your document will be
+printable using your favorite duplex mode for portrait documents (e.g.,
+C<Tumble> if you prefer to turn the pages like those of a book -
+"vertical folding"; regardless of the orientation of the document).
+It has no effect if the input is a portrait document.
+This flag might not be suitable if you plan to read the output document
+on your screen.
=item B<--ps>
@@ -273,7 +269,7 @@ my $nup = 1;
my $column;
my $quiet;
my $man;
-my $norotate;
+my $autorotate;
my $psout;
GetOptions( "select|s=s" => \$select,
@@ -289,7 +285,7 @@ GetOptions( "select|s=s" => \$select,
"book" => \$book,
"ps" => \$psout,
"nup|n=i" => \$nup,
- "no-rotate" => \$norotate,
+ "auto-rotate"=> \$autorotate,
"1" => sub { $nup = 1 },
"2" => sub { $nup = 2 },
"3" => sub { $nup = 3 },
@@ -714,7 +710,7 @@ sub psnup {
if ((($bbox[2]-$bbox[0] > $bbox[3]-$bbox[1])
and not ($outwidth-2*$margin > $outheight-2*$margin))
or
- (defined $norotate
+ (not (defined $autorotate)
and not ($bbox[2]-$bbox[0] > $bbox[3]-$bbox[1])
and ($outwidth-2*$margin > $outheight-2*$margin))) {
($outheight, $outwidth) = ($outwidth, $outheight);
@@ -821,7 +817,7 @@ sub psnup {
($ow,$oh) = ($oh,$ow) if $rotate%2;
my $pagespecs;
- if (defined $norotate || $ow < $oh) {
+ if (not (defined $autorotate) || $ow < $oh) {
$pagespecs = $nup . ':' . join ('+', @ospecs);
} else {
$pagespecs = 2*$nup . ':' . join ('+', @ospecs)
@@ -851,8 +847,8 @@ sub pswrite {
($ow,$oh) = ($oh,$ow) if $rotate%2;
my $pagedevice;
- if (defined $norotate || $oh < $oh || $landscape) {
- $rotate = ($rotate+1)%4 if not (defined $norotate) and $oh < $ow;
+ if (not (defined $autorotate) || $oh < $oh || $landscape) {
+ $rotate = ($rotate+1)%4 if (defined $autorotate) and $oh < $ow;
$pagedevice = "/Orientation $rotate /PageSize [$outwidth $outheight]";
} else {
$pagedevice = "/PageSize [$outwidth $outheight]";