Skip to content

Configure custom size for addEasyprint #85

Description

@Nova-Scotia

Hi! Thanks so much for the addEasyprint button - I love that I don't have to create a static map for each of my interactive maps.

I'm creating some html files for colleagues where they can explore the map interactively then print a copy for presentations.

Unfortunately the downloads from addEasyprint are fairly low resolution. I've been unable to figure out how to configure a custom size. If it's possible to add a custom size (say, width = 3000 pixels by height = 1800 pixels), could you let me know how? This is in a quarto document - not shiny.

library(dplyr)
library(sf)
library(leaflet)
library(leaflet.extras2)

check <- st_as_sf(tibble(latitude = c(48, 48.00001, 49), 
                         longitude = c(-89, -89.0001, -90)), 
                  coords = c("longitude", "latitude"),
                  crs = "+proj=longlat +datum=WGS84 +no_defs")

check_bounds <- c(-87, 47, -91, 50)
leaflet() %>%
  fitBounds(check_bounds[1], check_bounds[2], 
            check_bounds[3], check_bounds[4]) %>%
  addTiles() %>%
  addMarkers(data = check) %>% 
  addProviderTiles("Esri.WorldTopoMap",group = "Topographic") %>%
  addProviderTiles("Esri.WorldImagery", group = "Imagery") %>%
  addLayersControl(
    baseGroups = c("Topographic", "Imagery"),
    options = layersControlOptions(collapsed = FALSE)
  ) |> 
  addEasyprint(options = easyprintOptions(
    title = "Save map to PNG",
    position = "topleft",
    filename = "check",
    hideControlContainer = FALSE, 
    sizeModes = c("CurrentSize"),
    exportOnly = TRUE
  ))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions