I am getting closer to a solution of using leaflet-easyPrint (https://github.com/rowanwins/leaflet-easyPrint). I was able to find a solution using Shiny (Shiny leaflet easyPrint plugin), but I am not very familiar with Shiny and it seems to cause me problems in other areas. Is there a way to use leaflet-easyPrint without shiny?
I am trying to mimic the examples from https://gist.github.com/jcheng5/c084a59717f18e947a17955007dc5f92
and am able to run my map with no errors, but the button does not show up.
code:
printPlugin <- htmlDependency("leaflet-easyPrint",
"2.1",
src=c(href="https://raw.githubusercontent.com/rowanwins/leaflet-easyPrint/gh-pages/src/"),
script="index.js")
registerPlugin <- function(map, plugin) {
map$dependencies <- c(map$dependencies, list(plugin))
map}
and I have the
registerPlugin(printPlugin)
before
onRender(
"function(el, x) {
L.easyPrint({
sizeModes: ['Current', 'A4Landscape', 'A4Portrait'],
filename: 'mymap',
exportOnly: true,
position: 'topleft',
hideControlContainer: true
}).addTo(this);}"
)
I would love it to work like the demo http://rowanwins.github.io/leaflet-easyPrint/
Sorry if my formatting is bad. Getting used to this all still.