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

@imprentajs/pdf

v0.1.0-alpha.11

Published

Imprenta's PDF engine: measure, paginate, paint. One WebAssembly module, every runtime.

Readme

@imprentajs/pdf

The Imprenta page engine, as a native Node addon. Measures text, paginates it, and places every glyph itself — no browser, no HTML, no CSS.

npm i @imprentajs/pdf@alpha
import { render } from '@imprentajs/pdf';

const { pdf, pages, diagnostics } = await render(ir, {
  fonts: [{ weight: 'regular', italic: false, data: robotoBytes }],
});

ir is a JSON string, not an object: it is faster across the addon boundary, and it is also what arrives from a file, a queue or an HTTP body. The usual way to produce it is @imprentajs/react.

What it is for

Documents whose pagination is the point — a fifty-thousand-page ledger, an invoice with a carried-forward total, a report whose header depends on what is on the page. Pages are painted and released as content arrives, so memory stays flat per page however long the document is.

  • render(ir, options){ pdf, pages, bytes, diagnostics }
  • renderToFile(ir, path, options) — no Buffer ever exists; use it for anything large
  • new Printer(page, options) from @imprentajs/pdf/stream — feed a document in pieces

Await every Printer call before the next, and send rows in batches of a hundred to a thousand: one at a time costs a round trip each and is slower than not streaming at all.

One engine, every runtime

The engine is a single WebAssembly module that imports nothing at all — no Node-API, no WASI, no shim — so there is no per-platform package to install and nothing to pick at run time. The same file runs in Node, the browser, Deno, Bun and on an edge worker, and on every platform a native build matrix leaves out: musl, which is to say Alpine, which is to say a great many Docker images.

The calls above go to a worker, so nothing blocks the thread that answers requests. In a browser there is no worker to hide behind and no filesystem to read the module from, so reach for the engine directly:

import { Engine } from '@imprentajs/pdf/engine';

const engine = await Engine.load({ wasm, fonts });
const { pdf } = engine.render(ir);   // synchronous: put it in a Worker

No cross-origin isolation, no SharedArrayBuffer, no COOP/COEP headers.

The bytes come back as a Uint8Array rather than a Buffer, because Buffer is Node's. Buffer.from(pdf) gets the string helpers back at no cost.

Speed. A WebAssembly module has no threads, so one engine renders on one core. The pool gets the cores back — across documents by dispatching them, and within one long document by splitting it. On 150,000 rows over 2,113 pages, twelve cores:

| | | |---|---:| | one engine | 2,840 ms | | split across twelve | 500 ms | | the native addon this replaced | 696 ms |

Same page count, same numbering, one file. Splitting happens on its own for a document long enough to be worth it; shard: false turns it off.

Status

Alpha. It works and is built test-first, but the API is not settled.

Apache-2.0 · github.com/imprenta-project/imprenta