Generate native PDF files from JSON and TypeScript.
Install
Terminal
npm install @paperjsx/json-to-pdf
Requires Node.js >=18.
Quick Start
TypeScript
import { PdfEngine } from "@paperjsx/json-to-pdf";
import { writeFileSync } from "node:fs";
const buffer = await PdfEngine.render({
meta: { title: "Monthly Update" },
page: { size: "Letter", margin: 48 },
children: [
{ type: "heading", value: "Monthly Update" },
{ type: "paragraph", value: "Revenue grew 18% month over month." },
],
});
writeFileSync("update.pdf", buffer);
Core API
PdfEngine.render(document, options?)— returns aUint8Arrayof the PDF.PdfEngine.renderStream(document, options?)— returns a NodeReadableadapter. The complete PDF is buffered before the stream emits, so it does not reduce peak render memory.
Rendering is native — no Chromium, no Puppeteer — and deterministic for repeatable builds and tests. Supports text, layout, graphics, images, tables, links, and bookmarks.
Pro
@paperjsx/json-to-pdf-pro adds advanced typography, digital signatures, timestamps, PDF/A, linearization, and production/self-hosted commercial rights.
Terminal
npm install @paperjsx/json-to-pdf-pro
Pro packages install directly from the public npm registry. Set PAPERJSX_LICENSE_KEY to the Ed25519-signed SDK license issued to your organization; never use a pj_live_… hosted API key here. See License & Pricing.