npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@pdfluent/node

v1.0.0-beta.10

Published

Enterprise PDF SDK for Node.js — rendering, text extraction, forms, annotations, redaction, encryption, and PDF/A compliance.

Readme

@pdfluent/node

Enterprise PDF SDK for Node.js, powered by a native Rust engine via napi-rs. Supports rendering, text extraction, forms, annotations, redaction, encryption, digital signatures, and PDF/A compliance validation.

Installation

npm install @pdfluent/node

Pre-built binaries are provided for:

| Platform | Architecture | |---|---| | macOS | x64, arm64 | | Linux (glibc) | x64, arm64 | | Linux (musl) | x64 | | Windows | x64 |

Quick start

const { PdfDocument } = require('@pdfluent/node');
const fs = require('fs');

const data = fs.readFileSync('document.pdf');
const doc = PdfDocument.open(data);

console.log(`Pages: ${doc.pageCount}`);
console.log(`Title: ${doc.info().title}`);

// Extract text from page 0
const text = doc.extractText(0);
console.log(text);

// Save after mutations
doc.save('output.pdf');

Async (recommended for servers)

const data = await fs.promises.readFile('document.pdf');
const doc = await PdfDocument.openAsync(data);

const text = await doc.extractTextAsync(0);
const render = await doc.renderPageAsync(0, { dpi: 150 });
// render.data — Buffer with RGBA pixels; render.width / render.height

Open from file path

const { openPdf } = require('@pdfluent/node');
const doc = openPdf('/path/to/document.pdf');

Features

  • Rendering — rasterise pages to RGBA pixels at any DPI, generate thumbnails
  • Text extraction — plain text per page or structured TextBlockInfo[] with coordinates
  • Text search — returns page indices containing the query string
  • Forms (AcroForm) — enumerate, read, and write field values
  • Annotations — read existing annotations, add highlight / freetext
  • Redaction — permanently remove text by search term
  • Encryption — encrypt with AES-256, decrypt password-protected PDFs
  • Digital signatures — validate existing signatures
  • Bookmarks — read the document outline
  • PDF/A compliance — validate against levels 1a/1b through 3a/3b/3u
  • Async API — Promise-based worker-thread execution; no event-loop blocking
  • TypeScript — full .d.ts declarations with JSDoc included

API reference

PdfDocument

Factory methods

| Method | Description | |---|---| | PdfDocument.open(data: Buffer) | Open synchronously from a Buffer | | PdfDocument.openAsync(data: Buffer) | Open on a worker thread | | PdfDocument.openWithPassword(data, password) | Open a password-protected PDF | | openPdf(path: string) | Convenience wrapper — open from file path |

Metadata & structure

const info = doc.info(); // { title, author, subject, keywords, creator, producer }
const outline = doc.bookmarks(); // BookmarkItem[]
const geo = doc.pageGeometry(0); // { width, height, rotation }

Rendering

// Synchronous
const result = doc.renderPage(0, { dpi: 150 });
// result.data — Buffer (RGBA), result.width, result.height

// Async (worker thread)
const result = await doc.renderPageAsync(0, { dpi: 300 });

// All pages in parallel
const pages = await doc.renderAll({ dpi: 72 });

// Thumbnail
const thumb = await doc.thumbnail(0, 256); // max 256 px on longest side

RenderOpts: { dpi?, background?, width?, height? }

Text extraction

const text = doc.extractText(0); // plain string
const blocks = doc.extractTextBlocks(0); // TextBlockInfo[] with x/y/fontSize
const hits = doc.searchText('invoice'); // number[] of page indices

Forms (AcroForm)

const fields = doc.formFields(); // FormFieldInfo[]
// fields[0] → { name, fieldType, value, readOnly }

const value = doc.getFieldValue('Address.Street');
doc.setFieldValue('Address.Street', '123 Main St');
doc.save('filled.pdf');

Annotations

const annots = doc.annotations(0); // AnnotationInfo[]

doc.addAnnotation(
  0,           // page index
  'highlight', // type: highlight | freetext | note | underline | strikeout | squiggly
  [100, 200, 300, 220], // rect [x0, y0, x1, y1] in PDF user-space points
  'Important'  // optional content
);
doc.save('annotated.pdf');

Redaction

const report = doc.redactText('John Doe'); // all pages
// report → { matchesFound, areasRedacted, pagesAffected }
doc.save('redacted.pdf');

Encryption

// Encrypt — saved copy is AES-256 protected; in-memory doc is unchanged
doc.encrypt('protected.pdf', 'secret');

// Decrypt — works on a doc opened with openWithPassword
doc.decrypt('plain.pdf');

Digital signatures

const sigs = doc.validateSignatures();
// sigs[0] → { status, fieldName, signer, timestamp, reason }

PDF/A compliance

// Per-document
const report = doc.validatePdfa('2b');
// report → { compliant, errorCount, warningCount, issues[] }

// Or as a module-level function (opens the file internally)
const { validatePdfa } = require('@pdfluent/node');
const report = validatePdfa('document.pdf', '2b');

Valid levels: "1a", "1b", "2a", "2b", "2u", "3a", "3b", "3u".

PdfPage

Obtain a page handle with doc.page(index). Provides the same render/text methods scoped to a single page.

const page = doc.page(0);
console.log(`${page.width} x ${page.height} pts`);

const pixels = await page.renderAsync({ dpi: 150 });
const text = page.text();
const blocks = page.textBlocks();
const annots = page.annotations();

Module-level functions

const { openPdf, mergePdfs, validatePdfa } = require('@pdfluent/node');

// Open from path
const doc = openPdf('/path/to/file.pdf');

// Merge multiple PDFs
mergePdfs(['a.pdf', 'b.pdf', 'c.pdf'], 'merged.pdf');

// Validate compliance
const report = validatePdfa('document.pdf', '2b');
console.log(report.compliant, report.errorCount);

Integration with Sharp

const sharp = require('sharp');
const result = doc.renderPage(0, { dpi: 150 });
await sharp(result.data, {
  raw: { width: result.width, height: result.height, channels: 4 }
}).png().toFile('page.png');

License

PDFluent Commercial License — free for evaluation; a valid license is required for production use.

Without a license key the SDK is fully functional; output PDFs carry an evaluation marker in /Producer metadata.

Links