[Env: OS: Win Xp; R 2.15.2; IDE: eclipse/StatET] Each time I update my heplots package, I get warnings from R CMD check on R-Forge, * checking sizes of PDF files under ?inst/doc? ... WARNING ?gs+qpdf? made some significant size reductions: compacted ?HE-examples.pdf? from 739Kb to 366Kb and upon submission to CRAN, a message from maintainers: On CRAN now: but again there were warnings about significant size reductions in PDF compaction, which should really be fixed on your end. however, I am unable to find what to do to fix this on my end. In my package directory, I have the vignette sources all under vignettes/, with copies of the .pdf and .Rnw under inst/doc for historical reasons. [Q: can I now safely delete the copies under inst/doc ?] inst/doc/ HE-examples.pdf HE-examples.Rnw vignettes/ HE-examples.pdf HE-examples.Rnw HE-examples.bib fig/ ... I have qpdf installed: > Sys.which(Sys.getenv("R_QPDF", "qpdf")) qpdf "c:\\Rtools\\bin\\qpdf.exe" > but, if I try to run it on the vignettes/HE-examples.pdf file, nothing happens: > tools::compactPDF("C:/Documents/workspace/heplots/vignettes/HE-examples.pdf") > Since vignettes are re-built from sources and then installed into inst/doc, I don't see why PDF compaction cannot be run as part of the build process. That is, if R CMD check --as-cran detects a problem, shouldn't there be some option for R CMD build that would run gs+qpdf to correct it? The idea of vignettes for R packages is a good thing, but, this problem (and others with vignettes) discourages me from using vignettes in packages, a bad thing. -- 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
On 21.04.2013 19:28, Michael Friendly wrote:> [Env: OS: Win Xp; R 2.15.2; IDE: eclipse/StatET] > > Each time I update my heplots package, I get warnings from R CMD check > on R-Forge, > > * checking sizes of PDF files under ?inst/doc? ... WARNING > ?gs+qpdf? made some significant size reductions: > compacted ?HE-examples.pdf? from 739Kb to 366Kb > > and upon submission to CRAN, a message from maintainers: > > On CRAN now: but again there were warnings about significant size > reductions in PDF compaction, which should really be fixed on your end. > > however, I am unable to find what to do to fix this on my end. In my > package directory, > I have the vignette sources all under vignettes/, with copies of the > .pdf and .Rnw > under inst/doc for historical reasons. [Q: can I now safely delete the > copies under > inst/doc ?] > > inst/doc/ > HE-examples.pdf > HE-examples.Rnw > vignettes/ > HE-examples.pdf > HE-examples.Rnw > HE-examples.bib > fig/ > ... > > I have qpdf installed: > > Sys.which(Sys.getenv("R_QPDF", "qpdf")) > qpdf > "c:\\Rtools\\bin\\qpdf.exe" > > > > but, if I try to run it on the vignettes/HE-examples.pdf file, nothing > happens: > > > > tools::compactPDF("C:/Documents/workspace/heplots/vignettes/HE-examples.pdf") > > > > > Since vignettes are re-built from sources and then installed into > inst/doc, I don't see why > PDF compaction cannot be run as part of the build process. That is, if > R CMD check --as-cran detects a problem, shouldn't there be some option for > R CMD build that would run gs+qpdf to correct it?Yes, see R CMD build --help that tells you --compact-vignettes= try to compact PDF files under inst/doc: "no" (default), "qpdf", "gs", "gs+qpdf", "both" Best, Uwe Ligges> > The idea of vignettes for R packages is a good thing, but, this problem > (and others with vignettes) discourages me from using vignettes in > packages, a bad thing. >
On 4/21/2013 1:28 PM, Michael Friendly wrote:> [Env: OS: Win Xp; R 2.15.2; IDE: eclipse/StatET] > > Each time I update my heplots package, I get warnings from R CMD check > on R-Forge, > > * checking sizes of PDF files under ?inst/doc? ... WARNING > ?gs+qpdf? made some significant size reductions: > compacted ?HE-examples.pdf? from 739Kb to 366Kb >To follow up my own post, I did some more checking of whether/how to compact PDFs on my own system. My conclusion is that that I am unable to comply with the request from CRAN maintainers, even though I would like to. Once again, I wonder why this cannot be handled on the CRAN side automatically. qpdf: running it from a cmd prompt (using the options from tools::compactPDF) doesn't do very much compression C:\R\test>qpdf --stream-data=compress --object-streams=generate HE-examples.pdf HE-examples-comp.pdf C:\R\test>dir HE-examples* 04/22/2013 10:55 AM 699,191 HE-examples-comp.pdf 04/22/2013 10:28 AM 756,624 HE-examples.pdf gs: I have gs installed at C:\Program Files\gs\gs9.07\bin\gswin32.exe, but the gs installer doesn't put itself on the path, so tools::compactPDF sees gs_cmd as empty: > gs_cmd = Sys.getenv("R_GSCMD", "") [1] "" so it can't run gs+qpdf. OK, so I try to do it manually: > Sys.setenv(R_GSCMD = "C:/Program Files/gs/gs9.07/bin/gswin32.exe") > setwd("test") > > tools::compactPDF("HE-examples.pdf") > tools::compactPDF("HE-examples.pdf", gs_quality="ebook") But this doesn't do anything, not even changing the timestamp on the file, because the file size doesn't change enough. C:\R\test>dir HE-examples.pdf 04/22/2013 10:28 AM 756,624 HE-examples.pdf -- 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