Generating a map is hard enough. Google has recently clamped down on their APIs which has left developers scrambling for open source solutions. In today’s article we will take a look at how to embed an OpenStreetMap tile into a PDF using LeafLet.js.
For our example, we have taken an example from the Leaflet.js website. We want to print this to PDF:
How to Do It
- Take a look at the sample HTML from Leaflet.js you can render a map as normal
- Get a free API key to use in our playground.
- Try it out on our playground using our headless chrome based example