| Line 1... |
Line 1... |
| 1 |
% File src/library/tools/man/compactPDF.Rd
|
1 |
% File src/library/tools/man/compactPDF.Rd
|
| 2 |
% Part of the R package, http://www.R-project.org
|
2 |
% Part of the R package, http://www.R-project.org
|
| 3 |
% Copyright 2011-2 R Core Team
|
3 |
% Copyright 2011-3 R Core Team
|
| 4 |
% Distributed under GPL 2 or later
|
4 |
% Distributed under GPL 2 or later
|
| 5 |
|
5 |
|
| 6 |
\name{compactPDF}
|
6 |
\name{compactPDF}
|
| 7 |
\alias{compactPDF}
|
7 |
\alias{compactPDF}
|
| 8 |
\alias{format.compactPDF}
|
8 |
\alias{format.compactPDF}
|
| Line 28... |
Line 28... |
| 28 |
that directory will be used.}
|
28 |
that directory will be used.}
|
| 29 |
\item{qpdf}{Character string giving the path to the \command{qpdf}
|
29 |
\item{qpdf}{Character string giving the path to the \command{qpdf}
|
| 30 |
command. If empty, \command{qpdf} will not be used.}
|
30 |
command. If empty, \command{qpdf} will not be used.}
|
| 31 |
\item{gs_cmd}{Character string giving the path to the GhostScript
|
31 |
\item{gs_cmd}{Character string giving the path to the GhostScript
|
| 32 |
executable, if that is to be used. On Windows this is the path to
|
32 |
executable, if that is to be used. On Windows this is the path to
|
| 33 |
\file{gswin32c.exe} or \file{gswin64c.exe}. If \code{""}, the
|
33 |
\file{gswin32c.exe} or \file{gswin64c.exe}. If \code{""} (the
|
| 34 |
function will try to find a platform-specific path to GhostScript.}
|
34 |
default), the function will try to find a platform-specific path to
|
| - |
|
35 |
GhostScript where required.}
|
| 35 |
\item{gs_quality}{A character string indicating the quality required:
|
36 |
\item{gs_quality}{A character string indicating the quality required:
|
| 36 |
the options are \code{"none"} (so GhostScript is not used),
|
37 |
the options are \code{"none"} (so GhostScript is not used),
|
| 37 |
\code{"printer"} (300dpi), \code{"ebook"} (150dpi) and
|
38 |
\code{"printer"} (300dpi), \code{"ebook"} (150dpi) and
|
| 38 |
\code{"screen"} (72dpi).}
|
39 |
\code{"screen"} (72dpi).}
|
| 39 |
\item{gs_extras}{An optional character vector of further options to be
|
40 |
\item{gs_extras}{An optional character vector of further options to be
|
| Line 48... |
Line 49... |
| 48 |
This by default makes use of \command{qpdf}, available from
|
49 |
This by default makes use of \command{qpdf}, available from
|
| 49 |
\url{http://qpdf.sourceforge.net/} (including as a Windows binary) and
|
50 |
\url{http://qpdf.sourceforge.net/} (including as a Windows binary) and
|
| 50 |
included with the CRAN Mac OS X distribution of \R. If \code{gs_cmd}
|
51 |
included with the CRAN Mac OS X distribution of \R. If \code{gs_cmd}
|
| 51 |
is non-empty and \code{gs_quality != "none"}, GhostScript will used
|
52 |
is non-empty and \code{gs_quality != "none"}, GhostScript will used
|
| 52 |
first, then \command{qpdf} if it is available. If \code{gs_quality !=
|
53 |
first, then \command{qpdf} if it is available. If \code{gs_quality !=
|
| 53 |
"none"} and \code{gs_cmd} is empty, an attempt will be made to find a
|
54 |
"none"} and \code{gs_cmd} is \code{""}, an attempt will be made to find a
|
| 54 |
GhostScript executable.
|
55 |
GhostScript executable.
|
| 55 |
|
56 |
|
| 56 |
\command{qpdf} and/or \command{gs_cmd} are run on all PDF files found,
|
57 |
\command{qpdf} and/or \command{gs_cmd} are run on all PDF files found,
|
| 57 |
and those which are reduced in size by at least 10\% and 10Kb are
|
58 |
and those which are reduced in size by at least 10\% and 10Kb are
|
| 58 |
replaced.
|
59 |
replaced.
|
| 59 |
|
60 |
|
| 60 |
The strategy of our use of \command{qpdf} is to (losslessly) compress
|
61 |
The strategy of our use of \command{qpdf} is to (losslessly) compress
|
| 61 |
both PDF streams and objects. Ghostscript compresses streams and more
|
62 |
both PDF streams and objects. GhostScript compresses streams and more
|
| 62 |
(including downsampling and compressing embedded images) and
|
63 |
(including downsampling and compressing embedded images) and
|
| 63 |
consequently is much slower and may lose quality (but can also produce
|
64 |
consequently is much slower and may lose quality (but can also produce
|
| 64 |
much smaller PDF files). However, quality \code{"ebook"} is perfectly
|
65 |
much smaller PDF files). However, quality \code{"ebook"} is perfectly
|
| 65 |
adequate for screen viewing and printing on laser printers.
|
66 |
adequate for screen viewing and printing on laser printers.
|
| 66 |
|
67 |
|
| Line 74... |
Line 75... |
| 74 |
documents are generated with object compression, but this does not
|
75 |
documents are generated with object compression, but this does not
|
| 75 |
seem to be the default for MiKTeX's \command{pdflatex}. For some PDF
|
76 |
seem to be the default for MiKTeX's \command{pdflatex}. For some PDF
|
| 76 |
files (and especially package vignettes), using GhostScript can
|
77 |
files (and especially package vignettes), using GhostScript can
|
| 77 |
dramatically reduce the space taken by embedded images (often screenshots).
|
78 |
dramatically reduce the space taken by embedded images (often screenshots).
|
| 78 |
|
79 |
|
| 79 |
Where both Ghostscript and \command{qpdf} are selected (when
|
80 |
Where both GhostScript and \command{qpdf} are selected (when
|
| 80 |
\code{gs_quality != "none"} and both executables are found), they are
|
81 |
\code{gs_quality != "none"} and both executables are found), they are
|
| 81 |
run in that order and the size reductions apply to the total
|
82 |
run in that order and the size reductions apply to the total
|
| 82 |
compression achieved.
|
83 |
compression achieved.
|
| 83 |
}
|
84 |
}
|
| 84 |
|
85 |
|
| Line 92... |
Line 93... |
| 92 |
\code{diff} arguments.
|
93 |
\code{diff} arguments.
|
| 93 |
}
|
94 |
}
|
| 94 |
|
95 |
|
| 95 |
\note{
|
96 |
\note{
|
| 96 |
The external tools used may change in future releases.
|
97 |
The external tools used may change in future releases.
|
| - |
|
98 |
|
| - |
|
99 |
Versions of GhostScript 9.06 and later give several times better
|
| - |
|
100 |
compression than 9.05 on some vignettes in CRAN packages.
|
| 97 |
}
|
101 |
}
|
| 98 |
|
102 |
|
| 99 |
\seealso{
|
103 |
\seealso{
|
| 100 |
\code{\link{resaveRdaFiles}}.
|
104 |
\code{\link{resaveRdaFiles}}.
|
| 101 |
|
105 |
|