R Webshot jpeg image is blank

I am trying to get a screenshot image of rPivotTable in Shiny. I am saving the rpivottable using saveWidget() from htmlwidgets. I then want to use webshot() to convert the html to jpeg image. The html generated from the saveWidget is displaying correctly in Firefox, but the image generated from webshot is blank. I have attached the image generated from webshot. myPivot.jpeg

Below is a sample code I am working with

mypivot <- rpivotTable(mtcars, rows = "cyl", cols = "mpg")

saveWidget(mypivot, "myPivot.html", selfcontained = FALSE)

webshot(url = "myPivot.html", file = "myPivot.jpeg")

I then tried to use one of the solutions from How to save Leaflet in RStudio map as png or jpg file? I am still getting just blank image as the output. Below is the image generated(Its completely blank white) RPlot.png

Below is the code i am using.


## create map
m <- leaflet() %>% addTiles()

## save html to png
saveWidget(m, "temp.html", selfcontained = FALSE)
webshot("temp.html", file = "Rplot.png",
        cliprect = "viewport")

Below is the information bout my R Session. I am using RStudio.

R> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
[2] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    
attached base packages:
[2] stats     graphics  grDevices utils     datasets  methods   base     
other attached packages:
[2] rpivotTable_0.1.5.20 htmlwidgets_0.6      mapview_1.1.0        leaflet_1.0.1        webshot_0.3          htmltools_0.3.5     
loaded via a namespace (and not attached):
 [2] Rcpp_0.12.5         RColorBrewer_1.1-2  plyr_1.8.4          R.methodsS3_1.7.1   R.utils_2.3.0       viridis_0.3.4       base64enc_0.1-3    
 [8] iterators_1.0.8     tools_3.2.2         gdalUtils_2.0.1.7   digest_0.6.9        viridisLite_0.1.3   satellite_0.2.0     lattice_0.20-33    
[15] jsonlite_0.9.22     gtable_0.2.0        png_0.1-7           foreach_1.4.3       shiny_0.13.2        DBI_0.4-1           yaml_2.1.13        
[22] rgdal_1.1-10        parallel_3.2.2      gridExtra_2.2.1     dplyr_0.4.3         httr_1.1.0          raster_2.5-8        stats4_3.2.2       
[29] grid_3.2.2          R6_2.1.2            plotly_3.6.0        sp_1.2-3            latticeExtra_0.6-28 tidyr_0.4.1         ggplot2_2.1.0      
[36] magrittr_1.5        scales_0.4.0        codetools_0.2-14    assertthat_0.1      mime_0.4            xtable_1.8-2        colorspace_1.2-6   
[43] httpuv_1.3.3        munsell_0.4.3       R.oo_1.20.0


Belated response!

The following works for me:


savedPivot <- "savedPivot.html"

(based on @malcook answer on SO here)