Leaflet map images

327 views
Skip to first unread message

Diff

unread,
May 23, 2016, 3:32:06 PM5/23/16
to Leaflet
I'm working on an app where I need to be able to capture a leaflet map and ultimately have it go to a PDF.  I've looked into using leaflet-image to get the map image, but it doesn't work with leaflet.markercluster.  Leaflet-image also requires html2canvas which forces my maps to be built with a canvas setting.  This setting messes up my diagonal hatch pattern on some of my map areas and renders them as black areas.

Are there any good alternatives to html2canvas (other than phantomjs) to be able to export/save a leaflet map?  Or is there a way to place a leaflet map into a PDF with javascript?

Claudio Schilling

unread,
May 24, 2016, 10:54:21 AM5/24/16
to leafl...@googlegroups.com
I've been using dom-to-image to generate a rendered image of the map DOM element and then placing it inside a PDF created with PDFKit, working flawlessly with some minor modifications.

Claudio


2016-05-23 16:32 GMT-03:00 Diff <a.t....@gmail.com>:
I'm working on an app where I need to be able to capture a leaflet map and ultimately have it go to a PDF.  I've looked into using leaflet-image to get the map image, but it doesn't work with leaflet.markercluster.  Leaflet-image also requires html2canvas which forces my maps to be built with a canvas setting.  This setting messes up my diagonal hatch pattern on some of my map areas and renders them as black areas.

Are there any good alternatives to html2canvas (other than phantomjs) to be able to export/save a leaflet map?  Or is there a way to place a leaflet map into a PDF with javascript?

--

---
You received this message because you are subscribed to the Google Groups "Leaflet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leaflet-js+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages