This is a wrapper function to execute the command chrome --headless
--print-to-pdf url
. Google Chrome (or Chromium on Linux) must be installed
prior to using this function.
chrome_print(url, output = xfun::with_ext(url, "pdf"), browser = "google-chrome",
extra_args = c("--disable-gpu"), verbose = FALSE)
A URL or local file path to a web page.
The (PDF) output filename. For a local web page
foo/bar.html
, the default PDF output is foo/bar.pdf
; for a
remote URL https://www.example.org/foo/bar.html
, the default output
will be bar.pdf
under the current working directory.
Path to Google Chrome or Chromium. This function will try to
find it automatically via find_chrome()
if the path is not
explicitly provided.
Extra command-line arguments to be passed to Chrome.
Whether to show verbose command-line output.
Path of the output file (invisibly).
https://developers.google.com/web/updates/2017/04/headless-chrome