Forms · Node.js and TypeScript

Create and fill PDF forms in Node.js

Build interactive AcroForm fields from Node.js (text inputs, checkboxes, radio groups and dropdowns) with generated appearance streams, then fill and flatten them later. No NeedAppearances hack required.

Last updated: 2026-06-29

Why Node.js and TypeScript needs this

Authoring interactive PDF forms in Node usually leans on the NeedAppearances flag and hope, so fields look right in one viewer and vanish in the next.

rust-pdf generates a full AcroForm with appearance streams baked in, so fields render correctly everywhere without relying on the viewer. Names support dotted hierarchy for grouped fields, and an existing form can be filled programmatically and flattened into static content.

Build the AcroForm once, then fill it per request in an Express or NestJS handler: set fields by their dotted names, flatten so the values become static, and return the finished document. The generated appearance streams mean fields render in every viewer, and the pure-FFI Koffi binding installs from npm with no node-gyp build.

  • Text fields, checkboxes, radio groups and dropdowns with generated appearance streams.
  • Hierarchical dotted field names for grouped data.
  • Fill an existing form and flatten it into non-editable content.

Build a form in Node.js with rust-pdf

Install from npm, then declare fields with rectangles in page coordinates. The snippet below is real Node.js from the reference docs.

npm install rustpdf

Node.js
const doc = new Document();
doc.addPage();
doc.textField("applicant.name", 0, [72, 700, 320, 720], "");
doc.checkbox("agree", 0, [72, 660, 88, 676], false);
doc.dropdown("plan", 0, [72, 620, 240, 640],
             ["Starter", "Pro", "Enterprise"], 1);
doc.radioGroup("billing", 0, [
  { rect: [72, 580, 88, 596], export: "monthly" },
  { rect: [140, 580, 156, 596], export: "annual" },
], 1);
doc.save("form.pdf");
doc.close();
Validated by: qpdfmutool

Creating, filling and flattening forms are part of the free tier in Node.js, no license token needed.

The full Node.js forms reference is in the documentation.

Forms in Node.js: FAQ

Do the form fields render without NeedAppearances in Node.js?

Yes. rust-pdf generates an appearance stream for every field, so checkboxes, text and choices display correctly in all viewers without the NeedAppearances workaround.

Can I fill an existing form in Node.js?

Yes. Load the PDF, set text fields, checkboxes, radios and dropdowns by name, and optionally flatten the form so the values become permanent static content.

Is form authoring free?

Yes. Creating, filling and flattening AcroForm fields is part of the free tier in Node.js.

Can I fill and flatten a form inside a request handler?

Yes. In an Express or NestJS route you load the form, set fields by their dotted names, flatten so the values become static content, and return the finished document. The generated appearance streams render in every viewer, so no client-side NeedAppearances workaround is needed.

Collect structured data with forms that always render

One Rust core, the same AcroForm output in every language. Form authoring is free; license the corporate features only when you ship them.