I have written an app that creates a downloadable report, I was hoping to use the pagedown
package to create a pdf from a html which is better formatted and more presentable. It tested fine locally on my machine. After deployment, the document failed to download with the following error from the logs:
Warning: Error in find_chrome: Cannot find Chromium or Google Chrome
[No stack trace available]
I am using Google Chrome to view the app but I am guessing there's more to it than this?
The code to handle the download is as follows:
output$downloadDrug <- downloadHandler(
filename = function() {("drug-instructions.pdf)},
content = function(file) {
src <- normalizePath('report_drugHTML.Rmd')
src2 <- normalizePath("printout.css")
label <- normalizePath("pxLabel.png")
logo <-normalizePath("logo.png")
fasting <- normalizePath("fasting.png")
owd <- setwd(tempdir())
on.exit(setwd(owd))
file.copy(src, 'report_drugHTML.Rmd', overwrite = TRUE)
file.copy(src2, "printout.css", overwrite = TRUE)
file.copy(label, "pxLabel.png", overwrite = TRUE)
file.copy(logo, "logo.png", overwrite = TRUE)
file.copy(fasting, "fasting.png", overwrite = TRUE)
library(rmarkdown)
out <- render('report_drugHTML.Rmd',
params = list(name = input$px_name, dob = input$dob),
'html_document')
library(pagedown)
out <- pagedown::chrome_print(out, "drug-instructions.pdf")
file.rename(out, file)
}
)
Any suggestions would be greatly appreciated.