Dear List, There seems to be an bug in compactPDF() or at least an inconsistency with the documented behaviour. The documentations states: Details: This by default makes use of ?qpdf?, available from <URL: http://qpdf.sourceforge.net/>, including a Windows binary. If ?gs_cmd? is non-empty, GhostScript is used. I don't have qpdf on my system so planned to use ghostscript. However, the code for compactPDF() has as it's first few lines: if (!nzchar(Sys.which(qpdf))) return() So because I don't have qpdf, compactPDF() always returns NULL:> nzchar(Sys.which(Sys.getenv("R_QPDF", "qpdf")))[1] FALSE> compactPDF("../analogue/pkg/inst/doc/analogue_methods.pdf", gs_cmd = "/usr/bin/")NULL no matter what I do. This is with:> sessionInfo()R version 2.13.0 alpha (2011-03-27 r55077) Platform: x86_64-unknown-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_GB.utf8 LC_NUMERIC=C [3] LC_TIME=en_GB.utf8 LC_COLLATE=en_GB.utf8 [5] LC_MONETARY=C LC_MESSAGES=en_GB.utf8 [7] LC_PAPER=en_GB.utf8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_GB.utf8 LC_IDENTIFICATION=C attached base packages: [1] tools stats graphics grDevices utils datasets [7] methods base Thanks, Gavin -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
On 11-03-27 8:48 AM, Gavin Simpson wrote:> Dear List, > > There seems to be an bug in compactPDF() or at least an inconsistency > with the documented behaviour.Thanks, looks easy to fix. I'll make the correction. (A bit more below...)> > The documentations states: > > Details: > > This by default makes use of ?qpdf?, available from<URL: > http://qpdf.sourceforge.net/>, including a Windows binary. If > ?gs_cmd? is non-empty, GhostScript is used. > > I don't have qpdf on my system so planned to use ghostscript. However, > the code for compactPDF() has as it's first few lines: > > if (!nzchar(Sys.which(qpdf))) > return() > > So because I don't have qpdf, compactPDF() always returns NULL: > >> nzchar(Sys.which(Sys.getenv("R_QPDF", "qpdf"))) > [1] FALSE > >> compactPDF("../analogue/pkg/inst/doc/analogue_methods.pdf", gs_cmd = "/usr/bin/")That won't work: you need the full path to the gs_cmd, not just its home directory. Duncan Murdoch> NULL > > no matter what I do. > > This is with: > >> sessionInfo() > R version 2.13.0 alpha (2011-03-27 r55077) > Platform: x86_64-unknown-linux-gnu (64-bit) > > locale: > [1] LC_CTYPE=en_GB.utf8 LC_NUMERIC=C > [3] LC_TIME=en_GB.utf8 LC_COLLATE=en_GB.utf8 > [5] LC_MONETARY=C LC_MESSAGES=en_GB.utf8 > [7] LC_PAPER=en_GB.utf8 LC_NAME=C > [9] LC_ADDRESS=C LC_TELEPHONE=C > [11] LC_MEASUREMENT=en_GB.utf8 LC_IDENTIFICATION=C > > attached base packages: > [1] tools stats graphics grDevices utils datasets > [7] methods base > > Thanks, > > Gavin
Maybe Matching Threads
- vignettes: problems with PDF compaction
- [R] consider running tools::compactPDF(gs_quality = "ebook")
- Error in compactPDF/find_gs_cmd or documentation?
- consider running tools::compactPDF(gs_quality = "ebook")
- consider running tools::compactPDF(gs_quality = "ebook")