Long-term archiving · Node.js and TypeScript
Create PDF/A in Node.js
Generate archival-grade PDF/A from Node.js with one method call. rust-pdf embeds the sRGB ICC profile, adds the output intent, writes the XMP metadata and document ID, and enforces the rules, so the output validates under veraPDF, the reference validator.
Last updated: 2026-06-29
Why Node.js and TypeScript needs this
Generating archival PDF/A is where headless-Chrome pipelines fall down in Node: they cannot seal every font, attach an output intent, or pass veraPDF, so the files fail an archive audit.
PDF/A is the version of PDF built to last: every font and color profile is sealed inside the file so it renders identically decades from now. It is mandatory for e-invoicing, public-sector archiving, legal, healthcare and finance. rust-pdf produces and validates PDF/A-1b, 2b, 2a, 3b, 3a and 4.
Because the Koffi binding is pure FFI with no node-gyp, you bundle the prebuilt native library beside an AWS Lambda or Vercel function and it loads at cold start, and PdfaLevel ships fully typed in index.d.ts. addFontFile embeds and subsets each font so the archived file stays self-contained, while save throws a typed PdfError if no license grants PDF/A.
- Levels A-1b, A-2b, A-2a, A-3b, A-3a and A-4 (the PDF 2.0 part), with the accessible a-levels building a full tagged structure tree.
- Fonts embedded and subset automatically, ICC profile and output intent added for you.
- XMP metadata kept in sync with the document info, validated by veraPDF.
Create PDF/A in Node.js with rust-pdf
Install from npm, call doc.pdfa with the level you need, then add fonts and pages. The snippet below is real Node.js from the reference docs and validates under veraPDF.
npm install rustpdf
const { Document, PdfaLevel } = require("rustpdf");
const doc = new Document();
doc.pdfa(PdfaLevel.A2b).setInfo({ title: "Q3 Report", author: "Acme Inc." });
const f = doc.addFontFile("Roboto-Regular.ttf");
doc.addPage();
doc.showText(f, 20, 72, 760, "Archival report");
doc.save("report_pdfa.pdf"); // throws PdfError without a license granting PDF/A
doc.close();
Node.js basic generation is free. PDF/A is a corporate feature, unlocked by one offline license token. See pricing & licensing.
The full Node.js PDF/A reference is in the documentation.
PDF/A in Node.js: FAQ
Which PDF/A levels are supported in Node.js?
rust-pdf creates PDF/A-1b, 2b, 2a, 3b, 3a and 4 (the PDF 2.0-based part, including 4e and 4f). Use a basic b-level for visual fidelity, an a-level for an accessible tagged structure, or a 3-level when you need to embed source files such as an e-invoice XML.
How is conformance verified?
Output is validated with veraPDF, the open-source reference validator for PDF/A, plus qpdf and mutool for structure. The claim is backed by validators, not adjectives.
Do I need a license to create PDF/A in Node.js?
PDF/A is a corporate feature and requires an active license token. Basic generation in Node.js is free. One offline token unlocks PDF/A in every supported language.
Are TypeScript type definitions included for the Node binding?
Yes. The npm package ships an index.d.ts, so Document, PdfaLevel and every method are fully typed. Your editor autocompletes the level constants and catches a wrong argument before save ever runs, with no separate @types package to install.
Archive documents that still open correctly in 2050
One Rust core, the same veraPDF-clean PDF/A in every language. Prototype on the free tier, then enable archival output with a single license token when you ship.