1

Context

I am working on a R package (called mapBliss) for making custom souvenir style maps which utilizes leaflet and the Mapbox-API.

Thanks to the help of SO I managed to figure out how to create a picture frame by using utilizing shiny and css.

My Question

I am looking to figure out how to take a screenshot of the picture that I made with the webshot package's appshot() function but for some reason I am unable to get it to capture the picture as I want it.

For the example, the code I am running produces the following (Shiny App) output:

# devtools::install_github("benyamindsmith/mapBliss")
library(mapBliss)

map<-plot_city_view("Jersalem, IL") |>
            frame_1(title_text="Jerusalem", 
                    subtitle_text="City of Gold", 
                    subtitle_font="Brush Script MT") 

map

enter image description here

If I want to capture the output using appshot() I get the following output:

library(webshot)

map |> appshot()

enter image description here

I assume its because appshot() is taking the screenshot before the shiny app fully renders. Is there a way to "delay" appshot() or is there another workaround?

Bensstats
  • 988
  • 5
  • 17
  • 1
    Haven't tried, but according to the docs, you have to `appshot` the app. You should be able to do that by a) supplying a path to the single-file app/app directory or b) an app object, *not* by capturing an object from within app. You can both supply a `timout` and a `delay` argument: https://www.rdocumentation.org/packages/webshot/versions/0.5.4/topics/appshot . Nifty app, by the way :-) – I_O Dec 20 '22 at 21:08

1 Answers1

0

Play with the vheight and delay parameters.

 plot_city_view("Jersalem, IL") |>
frame_1(title_text="Jerusalem", subtitle_text="City of Gold", subtitle_font="Brush Script MT") |> 
appshot(vheight = 1000, delay=10)

Bensstats
  • 988
  • 5
  • 17