Rendering an rmarkdown document on shinyapps.io

I read this useful article
https://rviews.rstudio.com/2017/06/28/printing-from-flex-dashboard/

and have tried to implement this in a flexdashboard so a download button renders a second RMD file and creates a png file. In my flexdashboard, I used the commands below and this works when I run it in RStudio but when I publish to shinyapps.io the file does not download.

I tried removing the webshot command and the download button happily creates the intermediate Summary.html file for download but this rather defeats the object. This suggests the problem is that webshot cannot 'see' the html file being rendered.

output$downloadFile <- downloadHandler(
filename = "Summary.png",
content = function(f){
webshot::webshot(rmarkdown::render("Summary.Rmd"), file = f)
})

What do you see in the logs?

Ah, thank you so much. I should have checked this.

The html file is rendering fine but my png file isn't being created by webshot because PhantomJS is not found.

I have got it working now.

2020-04-09T13:16:49.571637+00:00 shinyapps[2065231]: Output created: Summary.html
2020-04-09T13:16:49.622275+00:00 shinyapps[2065231]: PhantomJS not found. You can install it with webshot::install_phantomjs(). If it is installed, please make sure the phantomjs executable can be found via the PATH variable.