OpenStreetMap + LeafletJS + PDF

September 5th, 2018 / by api2pdf /

Introduction
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

  1. Take a look at the sample HTML from Leaflet.js you can render a map as normal
  2. Get a free API key to use in our playground.
  3. Try it out on our playground using our headless chrome based example
Tags: , , , , , , , , , , , ,

Comments are closed.