Authoring · Node.js and TypeScript
Generate a PDF in Node.js
Create PDFs programmatically from Node.js: pages, vector graphics, embedded and subset fonts with full Unicode shaping, justified paragraphs, tables and images. rust-pdf gives Node.js a fast, memory-safe core with deterministic output.
Why Node.js and TypeScript needs this
Node typically reaches for heavy wrappers or headless Chrome for anything past basic output, which is slow, fragile and never archival-grade.
Generation is the free foundation. Draw shapes, place shaped and kerned Unicode text, lay out wrapping paragraphs, embed JPEG and PNG images, and add links and bookmarks. Output is deterministic (the same input yields the same bytes), which makes it auditable and testable.
- Vector graphics, embedded and subset fonts, HarfBuzz-quality Unicode shaping and kerning.
- Wrapping and justified paragraphs, tables, images (JPEG, PNG, alpha, 16-bit).
- Deterministic output: identical bytes for identical input, ideal for audits and tests.
Generate a PDF in Node.js with rust-pdf
Install the package, then call the same idiomatic API every rust-pdf binding shares. The snippet below is real Node.js code from the reference docs.
const { Document } = require("rustpdf");
const doc = new Document(); // A4 by default
doc.addPage();
doc.setFillRgb(0.86, 0.20, 0.18);
doc.rect(72, 640, 200, 120); // x, y, width, height (points)
doc.fill();
doc.save("out.pdf");
doc.close();
This is part of the free tier in Node.js. No license required.
Full Node.js reference in the documentation.
Generation in Node.js: FAQ
Is generating PDFs free in Node.js?
Yes. All basic generation (pages, graphics, fonts, text, paragraphs, images, links, bookmarks, watermarks) is free forever. You only license corporate features such as PDF/A, signatures and encryption when you ship them.
Does it support Unicode and custom fonts?
Yes. Fonts are embedded and subset with HarfBuzz-quality shaping and kerning, using Type0 fonts with ToUnicode, so non-Latin scripts render and extract correctly.
Why a Rust core for Node.js?
One memory-safe, high-performance Rust core is exposed to Node.js through a thin idiomatic binding. You get the same engine, the same features and deterministic output, without a heavy runtime.
Generate a PDF in Node.js
One Rust core, the same output across every language. Prototype for free, license the corporate features when you ship.