[Rd] vignettes: problems with PDF compaction

Michael Friendly friendly at yorku.ca
Tue Apr 23 15:50:55 CEST 2013

On 4/22/2013 5:51 PM, Uwe Ligges wrote:
>> But this doesn't do anything, not even changing the timestamp on the
>> file, because the file size doesn't change enough.
> Either you changed it or not, there is no "not enough".

I meant that the code in tools::compact compares the sizes of the old
and new files and only replaces the old file if the change in size is 

  if (new/old < 0.9 && new < old - 10000) {
                 file.copy(tf, p, overwrite = TRUE)

At any rate, with R_GSCMD now fixed (Thx: Henrik), tools::compactPDF,
with gs_quality="ebook",
still does not reduce the size of my HE-examples.pdf file.

I tried the same on my Ubuntu system (R 2.15.2 also), and there I get

 > tools::compactPDF("HE-examples.pdf", gs_quality="ebook")
   compacted 'HE-examples.pdf' from 739Kb to 366Kb

So, I can now copy the compacted file back to my development tree
on Windows; however, as I understand things, vignettes are re-built
by R CMD build and --compact-vignettes=gs+qpdf has no effect.
So my Ubuntu-compacted file will be overwritten.

It's somewhat maddening to have to spend so much time to save ~373Kb
in order to avoid a CRAN warning.

Michael Friendly     Email: friendly AT yorku DOT ca
Professor, Psychology Dept. & Chair, Quantitative Methods
York University      Voice: 416 736-2100 x66249 Fax: 416 736-5814
4700 Keele Street    Web:   http://www.datavis.ca
Toronto, ONT  M3J 1P3 CANADA

More information about the R-devel mailing list