wch / webshot

Take screenshots of web pages from R
http://wch.github.io/webshot/
229 stars 37 forks source link

Screenshot for current page in Shiny #70

Closed laresbernardo closed 6 years ago

laresbernardo commented 6 years ago

I am working on a shinydashboard that shows a couple of KPIs. What I need is a button that can screenshot the whole "currently seen" dashboard on Shiny and save it on a PDF. I know I can use the appshot function but it won't work if I need a specific tab and it doesn't work because it requires a password to display the dashboards when opening it. Any idea how to accomplish this? Btw, I think that, if the Shiny is already loaded (say in shinyapps.io), there is NO need to reload a parallel R process with all the Shiny app to do a screenshot, right?

wch commented 6 years ago

If you want to take a screenshot of a web page loaded in a browser (like a Shiny app), that generally is not possible. There exist Javascript libraries that can simulate the DOM and take a screenshot of the simulated page, but they are not 100% perfect.

If you want to use webshot to take a screenshot of an app on shinyapps.io that requires login, I believe it is possible, but it would require writing some Javascript and passing it as the eval argument. The help page for webshot has a little more information about that.