Using pagedown to convert html reports to pdf

When working on RStudio locally, I use the pagedown package to knit RMarkdowns to paged htmls. I then convert the html reports to pdfs using pagedown::chrome_print(). I would like to replicate this workflow on Connect, but when I try to use pagedown::chrome_print() on RStudio Server Pro / RStudio Connect, I get:

Error in find_chrome() : Cannot find Chromium or Google Chrome

Is it possible to install Chromium or Google Chrome on these servers so that I can convert htmls to pdfs with pagedown?

1 Like

That sounds like a very cool workflow!! Please do share if you get anything publicly share-able!

You definitely can install Chromium on linux servers. You can think about this as a standard "system dependency" much like libxml2 or libgdal. On Ubuntu 18.04, for instance:

apt-get install -y chromium-browser

That command will differ depending on your operating system.

For example, here is some discussion on the "chromium" dependency for a different R package that requires this system dependency as well: https://github.com/rstudio/chromote/pull/14

1 Like

Thank you so much! Do you know if we would need Chromium installed on both the RStudio Server and the RStudio Connect Server? Additionally, would this need to be downloaded into a particular location / require changes to any configuration files on the server(s)?

Yes, this will need to be installed anywhere that the pagedown package is expected to be installed and run. It should not need any configuration of the products themselves, and there shouldn't need to be a particular location (usually apt or yum or dnf - or whatever the system package manager is - does the right thing).

Definitely let us know how it goes or if you run into any trouble!! :smiley:

1 Like