OSM with Leaflet to JPG / PNG

41 views
Skip to first unread message

Igor Xhativa

unread,
Apr 27, 2022, 4:21:14 PMApr 27
to Leaflet
Hi! How can I use Leaflet to create a graphic from OSM that is automatically saved to my server? Is there an extension for this? Many thanks for your help. Best regards, Igor

Nicholas Evanish

unread,
Apr 28, 2022, 3:45:58 PMApr 28
to Leaflet
Igor - Are you trying to basically get a screen shot JPG format of the leaflet map that is visible on the screen?

Igor Xhativa

unread,
Apr 29, 2022, 3:30:31 PMApr 29
to Leaflet
Hi! Thank you for your answer.

No, I would like to create a PDF-File with FPDF with a map. I use Leaflet to display the map on the screen. But how can I get the map into the PDF-File? I thought that it will work with a picture created by Leaflet. Best regards, Igor

Nicholas Evanish

unread,
May 6, 2022, 11:33:13 AMMay 6
to Leaflet
Igor - I am not sure how you would get the map image embedded into a PDF document unless you did some type of deep linking or direct injection of the image's binary data string value into the PDF document. 

Are you trying to make this PDF document dynamically, or as a one-off type "one-time only" PDF document?

Rob Simpson

unread,
May 7, 2022, 4:48:57 PMMay 7
to Leaflet
Have you looked at https://github.com/niklasvh/html2canvas ?

I am having some success pushing HTML elements with leaflet maps to png files.

Reply all
Reply to author
Forward
0 new messages