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

pdfplumber-wasm

v0.2.0

Published

WebAssembly/JavaScript bindings for pdfplumber-rs PDF extraction

Downloads

110

Readme

pdfplumber-wasm

WebAssembly/JavaScript bindings for pdfplumber-rs — extract text, words, characters, and tables from PDFs in the browser or Node.js.

Features

  • Text extraction with optional layout detection
  • Word extraction with configurable tolerance
  • Table detection and extraction (lattice + stream strategies)
  • Character-level access with font, size, and position data
  • Regex search across page content
  • Zero native dependencies — runs entirely in WebAssembly

Installation

npm install pdfplumber-wasm

Browser Usage

<script type="module">
import init, { WasmPdf } from './pdfplumber_wasm.js';

await init();

const response = await fetch('document.pdf');
const bytes = new Uint8Array(await response.arrayBuffer());
const pdf = WasmPdf.open(bytes);

console.log(`Pages: ${pdf.pageCount}`);

const page = pdf.page(0);
console.log(page.extractText());

// Extract tables
const tables = page.extractTables();
for (const table of tables) {
  console.table(table);
}
</script>

With a Bundler (Webpack, Vite, etc.)

import { WasmPdf } from 'pdfplumber-wasm';

const response = await fetch('/document.pdf');
const bytes = new Uint8Array(await response.arrayBuffer());
const pdf = WasmPdf.open(bytes);

const page = pdf.page(0);
const text = page.extractText();

Node.js Usage

import { readFileSync } from 'fs';
import { WasmPdf } from 'pdfplumber-wasm';

const bytes = readFileSync('document.pdf');
const pdf = WasmPdf.open(bytes);

console.log(`Pages: ${pdf.pageCount}`);

const page = pdf.page(0);

// Extract text
console.log(page.extractText());

// Extract words with bounding boxes
const words = page.extractWords();
for (const word of words) {
  console.log(`"${word.text}" at (${word.x0}, ${word.top})`);
}

// Extract tables as 2D arrays
const tables = page.extractTables();
for (const table of tables) {
  for (const row of table) {
    console.log(row.join(' | '));
  }
}

// Search for text
const matches = page.search('hello', false, false);
console.log(`Found ${matches.length} matches`);

API Reference

WasmPdf

| Method / Property | Description | |---|---| | WasmPdf.open(data: Uint8Array) | Open a PDF from raw bytes | | .pageCount | Number of pages | | .page(index: number) | Get a page by 0-based index | | .metadata | Document metadata (title, author, etc.) |

WasmPage

| Method / Property | Description | |---|---| | .pageNumber | Page index (0-based) | | .width | Page width in points | | .height | Page height in points | | .extractText(layout?) | Extract text (optional layout detection) | | .extractWords(xTol?, yTol?) | Extract words with bounding boxes | | .chars() | Get all characters with font/position data | | .findTables() | Detect tables with cell structure | | .extractTables() | Extract tables as 2D text arrays | | .search(pattern, regex?, case?) | Search for text patterns |

TypeScript Types

Import type definitions for rich typing:

import type {
  PdfChar,
  PdfWord,
  PdfTable,
  PdfTableData,
  PdfSearchMatch,
  PdfMetadata,
  BBox,
} from 'pdfplumber-wasm';

Building from Source

# Install wasm-pack
cargo install wasm-pack

# Build for bundlers (Webpack, Vite, Rollup)
wasm-pack build --target bundler crates/pdfplumber-wasm

# Build for Node.js
wasm-pack build --target nodejs crates/pdfplumber-wasm

# Build for browser (no bundler)
wasm-pack build --target web crates/pdfplumber-wasm

Comparison with Other Tools

| Feature | pdfplumber-wasm | pdf.js | pdf-lib | |---|---|---|---| | Text extraction | Yes | Yes | No | | Table detection | Yes | No | No | | Word grouping | Yes | Partial | No | | Character positions | Yes | Yes | No | | Regex search | Yes | No | No | | Runs in browser | Yes | Yes | Yes | | Runs in Node.js | Yes | Yes | Yes |

Performance

pdfplumber-wasm is compiled from Rust to WebAssembly, offering near-native performance for PDF extraction tasks. Benchmarks show 2-5x speedup over pure JavaScript PDF processing libraries for text and table extraction.

License

MIT OR Apache-2.0