Question

I created a shiny app and now i want to plot a chart to pdf. So, is there any way to print a googlevis Chart to pdf in R.

I know its not possible directly, as stated in the help pages. But is there a way to print a static image (similar to a screenshot)? If possible without sweave/knitr?

Thank you in advance

No correct solution

OTHER TIPS

You can do this using wkhtmltopdf, which you need to install and possibly add to your system path. I have got this working for other googlevis objects, where in some cases I did not need the --enable-javascript --javascript-delay option....

output$downloadmap <- downloadHandler("mymap.pdf" , 
  content = function(file) {
    #print gmap googlevis R object to a html file
    print(gmap, file="gmap.html")
    #call to wkhtmltopdf installed on server/pc to convert html file to pdf. 
    #add a delay otherwise (i got an) empty plot
    system("wkhtmltopdf --enable-javascript --javascript-delay 2000 gmap.html gmap.pdf")
    #copy pdf file to output
    file.copy("gmap.pdf", file)
    #remove created files from local storage
    file.remove("gmap.pdf")
    file.remove("gmap.html")
  }
)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top