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 stream for large documents.
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
Set PAPERJSX_LICENSE_KEY from your dashboard. See License & Pricing.