On Sun, 8 Oct 2023 16:47:41 +0100
Michael Dewey <li...@dewey.myzen.co.uk> wrote:

> Following on from Ivan's advice I have now installed qpdf and
> Ghostview. I have checked that they are both on my path by typing
> their name at the command line and verifying they open.

> I then built the package with the --compress-vignettes=both and then
> checked it with --as-cran I still get a complaint that it needs qpdf
> to check compression.

While running R, does Sys.which('qpdf') return the path to qpdf.exe?
Does Sys.getenv('PATH') match your expectations?

> I notice that in the Writing R Extensions manual in section 1.6.1 it
> states "The full path to the qpdf command can be supplied as
> environment variable R_QPDF ..."
> 
> Is that a typo for "must be supplied"?

Well, R tries to resolve the path to qpdf.exe using Sys.which(), so it
must work if it's on the %PATH%, but if all else fails, setting this
environment variable should help.

> If it is where can I find the answers to questions about how R
> accepts Windows paths? Do I need to enclose parts of names containing
> spaces in "" signs?

It always depends on how the final command line is built by a
particular function, but it should work by taking plain file paths
without any escaping and quotation. The directory separators shouldn't
matter either.

(tools::compactPDF uses system2(), so it quotes the path to the
executable by itself.)

> Does it mean the path up to, in this case, bin or must I include
> qpdf.exe after it?

It must be the full path to the executable, including the final
qpdf.exe.

> I assume I do not need to do anything special to get it to find
> Ghostscript?

tools::compactPDF() expects gswin64c.exe or gswin32c.exe on the PATH.
If it's not there, R_GSCMD must be set to the full path to the
executable. Judging by the NOTE you've received, it's Ghostscript that
performed most of the compaction in your case.

-- 
Best regards,
Ivan

______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to