# json-to-svg-to-pdf

> Converts JSON/CSON input through SVG templates and renders them to PDF using librsvg

Latest version **1.1.0** (published 2017-05-08) · GPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install json-to-svg-to-pdf
pnpm add json-to-svg-to-pdf
yarn add json-to-svg-to-pdf
bun add json-to-svg-to-pdf
```

Provides the command `json-to-svg-to-pdf`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2017-05-08 |
| First published | 2017-05-03 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Justin Searls |
| Maintainers | searls |
| Keywords | json, cson, svg, pdf |

## Links

- npm: https://www.npmjs.com/package/json-to-svg-to-pdf
- Repository: https://github.com/testdouble/json-to-svg-to-pdf
- Homepage: https://github.com/testdouble/json-to-svg-to-pdf#readme
- Issues: https://github.com/testdouble/json-to-svg-to-pdf/issues
- npm.io page: https://npm.io/package/json-to-svg-to-pdf

## Dependencies (6)

- [cson](https://npm.io/package/cson.md) ^4.1.0
- [glob](https://npm.io/package/glob.md) ^7.1.1
- [async](https://npm.io/package/async.md) ^2.4.0
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [minimist](https://npm.io/package/minimist.md) ^1.2.0
- [mustache](https://npm.io/package/mustache.md) ^2.3.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.1.0 (latest) — 2017-05-08
- 1.0.0 — 2017-05-03

## README

# json-to-svg-to-pdf

This is a silly module we wrote to generate business cards. As a result,
consider this module very
[YMMV](https://en.wiktionary.org/wiki/your_mileage_may_vary). (Spoiler alert:
the code is intentionally dense for use as a refactoring exercise.)

To use this yourself:

1. Define two SVG templates in `template/front.svg` and `template/back.svg` with
   whatever [mustache](https://mustache.github.io) template strings you like
   (e.g. `{{fullName}}`)
2. Create a JSON/CSON for each person in `input/` (e.g. `input/justin.cson`)
   that defines those mustache attribute names
3. Run `json-to-svg-to-pdf`

What you'll get is, for each input file, a pair of font-embedded PDFs in
`output/` (e.g.
`output/justin-front.pdf` and `output/justin-back.pdf`).

## Prerequisites

The PDF generation relies on [librsvg](https://github.com/GNOME/librsvg)'s
`rsvg-convert` being on your path.

To install it on a Mac with [homebrew](https://brew.sh), run `brew install
librsvg`.

## TODO

The glaring limitation currently is the code assumes you have exactly two
templates defined for each input. It could be complicated/improved to discover
1…n templates and follow the same naming pattern

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