Channel guide

PDFluent for Node.js

Generally availableUpdated 2026-09-22
Star on GitHub
On this page

Install

One command. The package is on npm today.

npm install @pdfluent/node

Smoke test

Open a PDF, print the page count. The example below is the smallest useful program — copy, paste, run.

typescript
import { PdfDocument } from '@pdfluent/node';
import { readFileSync } from 'node:fs';

const doc = PdfDocument.open(readFileSync('invoice.pdf'));
console.log(`${doc.pageCount} pages`);

TypeScript

The package ships index.d.ts in the tarball — no @types/ install, no hand-written declarations to fall out of sync with the native binding.

A modern exports map ships the same typings to both module systems:

json
{
  ".": {
    "types": "./index.d.ts",
    "import": "./index.mjs",
    "require": "./index.js"
  }
}

That means import resolves to the ESM build (index.mjs) and require to CommonJS (index.js), and either way the compiler reads the same .d.ts. It resolves correctly under every current moduleResolution setting that understands package exports —node16, nodenext, and bundler. Under --strict, the extraction and forms surface — TextSpanInfo, TextBlockInfo, extractTextBlocks() — type-checks with no any.

What this is good for

  • Server-side PDF processing in a Node or TypeScript backend
  • Text extraction with page coordinates for search indexing and data pipelines
  • AcroForm fill and read-back in a document-generation service
  • Redaction, encryption, and PDF/A conversion as part of a document workflow

Current limitations

This list is honest, not exhaustive. The site-wide list lives at Known limitations.

  • Prebuilt binaries cover macOS (x64, arm64), Linux glibc (x64, arm64), Linux musl (x64), and Windows (x64). Less common platforms need a build-from-source step.
  • Text find-and-replace currently takes and returns JSON strings rather than typed objects; typed overloads for that part of the API are planned. Everything else — text extraction, forms, annotations — already returns typed objects and arrays.
  • XFA rendering fidelity is improving alongside the Rust core; complex dynamic forms may render with visual deltas.

Licensing

PDFluent is published under the AGPLv3 and is complete under it. A yearly commercial licence removes the obligation to publish your own source; nothing in the build differs and nothing is activated, so a lapsed licence breaks nothing you have shipped. Details on the licensing page.

Where to go next