# NOT RUN {
## Only run examples in interactive R sessions
if (interactive()) {
library(shiny)
library(leaflet)
library(leaflet.extras2)
ui <- fluidPage(
leafletOutput("map"),
selectInput("scene", "Select Scene", choices = c("CurrentSize", "A4Landscape", "A4Portrait")),
actionButton("print", "Print Map")
)
server <- function(input, output, session) {
output$map <- renderLeaflet({
input$print
leaflet() %>%
addTiles() %>%
setView(10, 50, 9) %>%
addEasyprint(options = easyprintOptions(
exportOnly = TRUE
))
})
observeEvent(input$print, {
leafletProxy("map") %>%
easyprintMap(sizeModes = input$scene)
})
}
shinyApp(ui, server)
}
# }
Run the code above in your browser using DataLab