title: Export/print map in Leaflet
body: <p>I'm working with leaflet and pure JS/jQuery to make a choropleth map and i've a problem when i try to export it to a local file as PNG/PDF/etc. I want to save the map directly in the main folder, pressing a <code>control print button</code>, editing the default output path if it is possible.</p>
  
  <p>In leaflet documentation appear <a href="http://leafletjs.com/plugins.html#printexport" rel="nofollow noreferrer">four plugins to make it</a>:</p>
  
  <ul>
  <li><p>using <code>Leaflet.print</code>: i couldn't apply it, maybe for my little knowledge in js/leaflet/mapfish to use it. There is no page demo available to see how works. Then i opened the html example on github, index.html, to see how works, but it is used Mapfish to make the print, using a <code>info.json</code> file... I have a layergroup using two jsons to paint and colour polygons, as you can see in the JSFiddle link below.</p></li>
  <li><p>using <code>Leaflet-image</code>: i applied it and it generated a map, only with the base of mapbox, at right side of the original map using a topright button.</p></li>
  <li><p>using <code>Leaflet-easyPrint</code>: it works: generate the control button at topleft (<strong>OK, i like the button!</strong>) and print the map BUT in the print preview it doesn't show the legend colours.</p></li>
  <li><p>using <code>leaflet.browser.Print</code>: similar as easyPrint in demo, but i do not want the whole browser view. I only want the map, so i didn't try it.</p></li>
  </ul>
  
  <p>Also, i tried a <a href="http://www.jqueryscript.net/other/jQuery-Plugin-To-Print-Any-Part-Of-Your-Page-Print.html" rel="nofollow noreferrer">jQuery print plugin using map div id</a>, but the export map had not the colour legend (and i want to save in a local file).</p>
  
  <p>Therefore, is there a way to do it? If you can explain it to me step-by-step i would be very grateful.</p>
  
  <p>This is a <a href="http://jsfiddle.net/Ljetvd2x/6/" rel="nofollow noreferrer">JSFiddle</a> applying <code>leaflet-easyPrint</code> and <code>leaflet-image</code>.</p>