summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem.moulin@ens-lyon.org>2012-01-20 18:41:01 +0100
committerGuilhem Moulin <guilhem.moulin@ens-lyon.org>2012-01-20 18:41:01 +0100
commitab3baae5ea925c50a7d3bc5fe1ee1b809770f066 (patch)
tree44a8392a99ff62dfad1b7bb9ff6ef40cd3130bc6
parent64c01ddf79fa9a0a9a4398f46dcdbdc5e3f006ff (diff)
pswrite -> ps2write; preserve image quality in PDFs
-rwxr-xr-xpdftool.pl25
1 files changed, 14 insertions, 11 deletions
diff --git a/pdftool.pl b/pdftool.pl
index ca9f2a5..fd8e4c7 100755
--- a/pdftool.pl
+++ b/pdftool.pl
@@ -52,7 +52,7 @@ 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 PDF document; see B<--ps> to
+default, B<PDFTool> outputs a PDF document; Use B<--ps> to
get a PostScript instead.
B<PDFTool> does the following passes on the input document:
@@ -182,9 +182,6 @@ on your screen.
By default, B<PDFTool> outputs a PDF document; use this flag if
you want a PostScript 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.
-
=item B<--column>
@@ -531,8 +528,7 @@ sub pdftops {
}
# Convert to PS
- # TODO: use gs & pswrite the day it'll handle fonts properly
- # (the flag `-origpagesizes' seems not to be portable)
+ # TODO: use gs & ps2write, more portable
my @cmd = ('pdftops', '-origpagesizes', $infile, '-');
push @cmd, '-f', $first if defined $first;
push @cmd, '-l', $last if defined $last;
@@ -851,11 +847,18 @@ sub pswrite {
$pagedevice = "/PageSize [$outwidth $outheight]";
}
- my @device = ('-sDEVICE=pdfwrite');
- @device = ('-sDEVICE=pswrite', '-dLanguageLevel=3')
- if defined $psout;
- my @cmd = (@gs, @device, '-dQUIET', '-dBATCH', '-dNOPAUSE',
- '-sOutputFile=%stdout%', '-dAutoRotatePages=/None',
+ my $device = '-sDEVICE=pdfwrite';
+ $device = '-sDEVICE=ps2write' if defined $psout;
+ my @cmd = (@gs, '-dQUIET', '-dBATCH', '-dNOPAUSE', $device,
+ '-dAutoRotatePages=/None',
+ '-dDetectDuplicateImages=false',
+ # Preserve image quality
+ '-dAutoFilterColorImages=false',
+ '-dAutoFilterGrayImages=false',
+ '-dColorImageFilter=/FlateEncode',
+ '-dGrayImageFilter=/FlateEncode',
+ '-dMonoImageFilter=/FlateEncode',
+ '-sOutputFile=%stdout%',
'-c', "<< $pagedevice >> setpagedevice",
'-f', '-');