# osm2pdf

> Generate pdf from OpenStreetMap tiles

Latest version **3.2.0** (published 2026-06-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install osm2pdf
pnpm add osm2pdf
yarn add osm2pdf
bun add osm2pdf
```

Provides the command `osm2pdf`.

## Health

**Score 55/100 (C)** — status: active.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 3.2.0 |
| Published | 2026-06-06 |
| First published | 2019-09-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 9 |
| Unpacked size | 310.8 KB |
| Known vulnerabilities | 0 (+25 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 12 |
| Author | mrkvon |
| Maintainers | mrkvon |
| Keywords | osm, openstreetmap, pdf, map, maps, offline-map |

## Links

- npm: https://www.npmjs.com/package/osm2pdf
- Repository: https://github.com/osm2pdf/osm2pdf
- Issues: https://github.com/osm2pdf/osm2pdf/issues
- npm.io page: https://npm.io/package/osm2pdf

## Dependencies (9)

- [gm](https://npm.io/package/gm.md) ^1.23.1
- [axios](https://npm.io/package/axios.md) ^0.19.2
- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [pdfkit](https://npm.io/package/pdfkit.md) ^0.12.3
- [fs-extra](https://npm.io/package/fs-extra.md) ^8.1.0
- [minimist](https://npm.io/package/minimist.md) ^1.2.0
- [haversine](https://npm.io/package/haversine.md) ^1.1.1
- [merge-img](https://npm.io/package/merge-img.md) ^2.1.3
- [axios-rate-limit](https://npm.io/package/axios-rate-limit.md) ^1.3.0

## Alternatives

- [@cantoo/pdf-lib](https://npm.io/package/@cantoo/pdf-lib.md) — 297.9K weekly downloads
- [datatables.net-buttons](https://npm.io/package/datatables.net-buttons.md) — 200.1K weekly downloads
- [@ckeditor/ckeditor5-export-pdf](https://npm.io/package/@ckeditor/ckeditor5-export-pdf.md) — 167.0K weekly downloads
- [scanbot-web-sdk](https://npm.io/package/scanbot-web-sdk.md) — 15.0K weekly downloads
- [@syncfusion/ej2-angular-pdfviewer](https://npm.io/package/@syncfusion/ej2-angular-pdfviewer.md) — 8.8K weekly downloads

## Recent versions

- 3.2.0 (latest) — 2026-06-06
- 3.1.2 — 2022-07-10
- 3.1.1 — 2022-07-08
- 3.1.0 — 2022-07-08
- 3.0.0 — 2021-09-13
- 2.2.4 — 2020-10-05
- 2.2.3 — 2020-10-03
- 2.2.2 — 2020-10-03
- 2.2.1 — 2020-10-03
- 2.2.0 — 2020-10-03
- 2.1.2 — 2020-07-29
- 2.1.1 — 2020-07-29
- 2.1.0 — 2020-06-22
- 2.0.5 — 2020-01-24
- 2.0.4 — 2020-01-24
- … 12 more at https://npm.io/package/osm2pdf/versions

## README

# OSM map to pdf

[![npm version](https://badge.fury.io/js/osm2pdf.svg)](https://www.npmjs.com/package/osm2pdf)

Generate pdf with [OpenStreetMap](https://openstreetmap.org) tiles.

![example output of osm2pdf with --route parameter](https://raw.githubusercontent.com/osm2pdf/osm2pdf/main/examples/route/preview.png)

<!--
## Video

[![How to download OpenStreetMap with osm2pdf](https://img.youtube.com/vi/DiPj8yaXapA/0.jpg)](https://youtu.be/DiPj8yaXapA)
-->

## Usage

See also [examples](https://github.com/osm2pdf/osm2pdf/tree/main/examples).

### Download a route

You need to provide a route in GPX format. You can download it e.g. on [graphhopper website](https://graphhopper.com/maps/) or bicycle planning website [cycle.travel](https://cycle.travel/map).

```bash
npx osm2pdf --route --zoom=10 --input=path/to/route.gpx --output=path/to/output --tile-server=1
```

### Download a map

You need to provide GPS boundaries of the area you want to download.

```bash
npx osm2pdf --map -n=70.923 -w=-4.373 -s=55.756 -e=27.872 --zoom=9 --output=path/to/output --tile-server=2
```

### Show available tile servers

```bash
npx osm2pdf --list-tile-servers
```

## Help

```bash
npx osm2pdf --help
```

## Node compatibility

We use [ECMAScript Modules](https://nodejs.org/docs/latest/api/esm.html) which are supported since Node v8.

## Use responsibly

Tiles are provided by various [tile providers](https://wiki.openstreetmap.org/wiki/Raster_tile_providers). Please use their resources responsibly and follow their respective usage policies.

---
_Source: https://npm.io/package/osm2pdf · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
