summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem.moulin@ens-lyon.org>2012-01-07 18:05:52 +0100
committerGuilhem Moulin <guilhem.moulin@ens-lyon.org>2012-01-07 18:05:52 +0100
commitb392143d67e61b45d8fe0b6eb4134e74fe0b17fa (patch)
treeb757d78ee809a4b99fbf299580f3effe5740ee88
parenta439a6fe0db71f6e53adf1b18f714f24439c50e0 (diff)
PDF output by default
-rwxr-xr-xpdftool.pl32
1 files changed, 17 insertions, 15 deletions
diff --git a/pdftool.pl b/pdftool.pl
index 13e9c45..f92df3d 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<--pdf>] [B<-q>] [I<infile> [I<outfile>]]
+[B<-n> I<num>] [B<--no-rotate>] [B<--ps>] [B<-q>] [I<infile> [I<outfile>]]
=head1 DESCRIPTION
@@ -52,9 +52,8 @@ is I<a4>.
If no output file is given, or if a single hyphen-minus (I<->) is given as
file name, B<PDFTool> sends the data to the standard output. By
-default, B<PDFTool> outputs a PostScript document; see the B<--pdf> to
-get a PDF instead. Note that due to a L<known limitation|http://www.ghostscript.com/doc/current/Issues.htm#Known_Limitations> of C<gs> with
-the C<pswrite> device, the PostScript output might not be suitable for uses other than printing.
+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
@@ -93,8 +92,7 @@ Put multiple pages per sheets (option B<-n>), and
=item *
-"Flatten" the output, and convert back to PDF if necessary
-(option B<--pdf>).
+"Flatten" the output, and convert it to PDF (if the flag B<--ps> is not set).
=back
@@ -187,11 +185,14 @@ 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.
-=item B<--pdf>
+=item B<--ps>
+
+By default, B<PDFTool> outputs a PDF document; use this flag if
+you want a PostScript instead e.g., to pipe the output into C<lpr> (not
+possible with a PDF since reading requires random access to the data).
+Note that due to a L<known limitation|http://www.ghostscript.com/doc/current/Issues.htm#Known_Limitations> of C<gs> with
+the C<pswrite> device, the PostScript output might not be suitable for uses other than printing.
-By default, B<PDFTool> outputs a PostScript file; use this flag if
-you want a PDF instead. Note that since reading a PDF requires random
-access to the data, you will not be able to pipe the output to C<lpr> then.
=item B<--column>
@@ -223,7 +224,7 @@ The following comand can be used to remotely crop a PDF file, convert it
to A4 paper, and rearrange the pages to locally print a (PostScript)
booklet with custom margins:
-C<< ssh remote pdftool.pl -cpA4 --book -2 -b2cm -m-1cm < in.pdf |
+C<< ssh remote pdftool.pl -cpA4 --book -2 -b2cm -m-1cm --ps < in.pdf |
lpr -o Duplex=DumplexTumble >>
=head1 REQUIREMENTS
@@ -273,7 +274,7 @@ my $column;
my $quiet;
my $man;
my $norotate;
-my $pdfout;
+my $psout;
GetOptions( "select|s=s" => \$select,
"w|width=s" => \$outwidth,
@@ -286,7 +287,7 @@ GetOptions( "select|s=s" => \$select,
"border|b=s" => \$border,
"crop|c" => \$crop,
"book" => \$book,
- "pdf" => \$pdfout,
+ "ps" => \$psout,
"nup|n=i" => \$nup,
"no-rotate" => \$norotate,
"1" => sub { $nup = 1 },
@@ -857,8 +858,9 @@ sub pswrite {
$pagedevice = "/PageSize [$outwidth $outheight]";
}
- my @device = ('-sDEVICE=pswrite', '-dLanguageLevel=3');
- @device = ('-sDEVICE=pdfwrite') if defined $pdfout;
+ my @device = ('-sDEVICE=pdfwrite');
+ @device = ('-sDEVICE=pswrite', '-dLanguageLevel=3')
+ if defined $psout;
my @cmd = (@gs, @device, '-dQUIET', '-dBATCH', '-dNOPAUSE',
'-sOutputFile=%stdout%', '-dAutoRotatePages=/None',
'-c', "<< $pagedevice >> setpagedevice",