[GIS] In a webgis using leaflet, how to export maps as pdf

leafletweb-mapping

Like the title says, I'm building a webgis using Leaflet. I want to allow users to export maps from the website and download them, but the current downloaded format is shapefile. I wonder if there's a configuration that enables export format as pdf.

As it may be related, the maps only show the regions in which data are visualized and hide the rest of Leaflet base map. Can you tell if this configuration will be preserved in pdf exported outputs?

Best Answer

I wonder if there's a configuration that enables export format as pdf.

No. Leaflet does nothing of the likes of that.

If you want PDFs, you'll need to print PDFs. You can let the users do just that with their web browsers - but if you really need the users to download PDFs, then you can run tools like wkhtmltopdf or a PahtomJS script server-side to generate those PDF files. These work by creating headless (server-less) web browsers and opening your webapp.

Related Question