From b392143d67e61b45d8fe0b6eb4134e74fe0b17fa Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Sat, 7 Jan 2012 18:05:52 +0100 Subject: PDF output by default --- pdftool.pl | 32 +++++++++++++++++--------------- 1 file 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 [B<-w> I ] [B<-h> I] [B<-p> I] [B<-W> I] [B<-H> I] [B<-P> I] [B<-s> I] [B<-m> I] [B<-b> I] [B<-c>] [B<--book>] [B<--column>] -[B<-n> I] [B<--no-rotate>] [B<--pdf>] [B<-q>] [I [I]] +[B<-n> I] [B<--no-rotate>] [B<--ps>] [B<-q>] [I [I]] =head1 DESCRIPTION @@ -52,9 +52,8 @@ is I. If no output file is given, or if a single hyphen-minus (I<->) is given as file name, B sends the data to the standard output. By -default, B outputs a PostScript document; see the B<--pdf> to -get a PDF instead. Note that due to a L of C with -the C device, the PostScript output might not be suitable for uses other than printing. +default, B outputs a PDF document; see B<--ps> to +get a PostScript instead. By default, B 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). 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 outputs a PDF document; use this flag if +you want a PostScript instead e.g., to pipe the output into C (not +possible with a PDF since reading requires random access to the data). +Note that due to a L of C with +the C device, the PostScript output might not be suitable for uses other than printing. -By default, B 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 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", -- cgit v1.2.3