# PDFluent for Node.js — install with npm

Source: https://pdfluent.com/docs/node/

Channel guide

# PDFluent for Node.js

Generally available Updated 2026-09-22

[Star on GitHub](https://github.com/pdfluent/pdfluent-sdk)

### On this page

- Install
- Smoke test
- Structured extraction (Preview)
- TypeScript
- What this is good for
- Current limitations
- Licensing
- Where to go next

## Install

One command. The package is on [npm](https://www.npmjs.com/package/@pdfluent/node) 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`);
```

## Structured extraction (Preview)

Preview In Node, structured extraction returns Markdown from `doc.extractMarkdown`, blocks from `doc.extractBlocks`, words from `doc.extractWords`, Docling JSON from `doc.extractDocling`, and chunks from `iterChunks`. Structured extraction ships as Preview: output quality is still improving and the API may change in a minor release.

- Tiers: `fast` (default, the engine alone, no models) and `balanced` (Preview, native only, needs installed models).
- Enable balanced with `quality: "balanced"`; set model paths with `modelDir` and `tableModelDir`.
- Docling JSON: `doc.extractDocling({ firstPage, pageCount }, name)`.
- Page window: `firstPage` and `pageCount`; chunks come from `iterChunks(doc, { mode: "markdown" })`.

javascript

```
const fs = require("node:fs");
const { PdfDocument, iterChunks } = require("@pdfluent/node");

const doc = PdfDocument.open(fs.readFileSync("report.pdf"));
const md = doc.extractMarkdown();
const mdTables = doc.extractMarkdown({ quality: "balanced" });
for (const chunk of iterChunks(doc, { mode: "markdown" })) {
  console.log(chunk.text);
}
```

## 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](https://pdfluent.com/docs/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](https://pdfluent.com/docs/licensing/).

## Where to go next

- [Open npm Browse versions and the published API.](https://www.npmjs.com/package/@pdfluent/node)
- [View pricing Annual licences with perpetual-fallback.](https://pdfluent.com/pricing/)
- [Contact licensing We respond within one business day.](mailto:hello@pdfluent.com?subject=Licensing)
- [Compare channels Back to the homepage language chooser.](https://pdfluent.com/#choose-environment)
