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

parapdf

v0.9.0

Published

A fast PDF viewer for React, built on pdf.js

Readme

ParaPDF

A fast PDF viewer for React, built on pdf.js.

Status: 0.x. The API may change in any minor release until 1.0. parapdf.yhay81.com has the guides, the API reference, and a live demo.

  • React stays out of the hot path. Scrolling and zooming commit no React state per frame, and pixels never pass through React.
  • Only what is near the viewport exists. Pages outside a small window unmount. Each page draws a quick base first and full resolution once scrolling settles, and at high zoom only its visible part sharp, within pixel budgets you can set.
  • Pages you come back to show at once. A page that leaves the window keeps its canvases, within a budget.
  • Several viewers, one document. Each viewer has its own position, zoom, rotation, and layout; the document is opened, parsed, and searched once.
  • A document viewer. Selectable, accessible text; search that matches as pdf.js's viewer does, CJK text included; links, the outline, and history; forms, annotations, printing, saving, layers, attachments, thumbnails, spreads, scroll modes, and encrypted documents.
  • You load what you use. Forms (<PdfForms />), annotation editing (<PdfAnnotationEditor />), auto-linked addresses (<PdfAutoLinks />), search, printing, and the other features are in your bundle only when you import them.
  • pdf.js included. ParaPDF ships pdf.js's worker and the files it loads on demand, and your bundler serves them: there is nothing to set up.

Install

npm install parapdf

ParaPDF needs React 19.3 or later. It depends on pdfjs-dist 6.5.438 exactly, because it ships that version's worker and files.

Quick start

import { PdfDocument, PdfViewer } from "parapdf";

export function App() {
  return (
    <PdfDocument source="/manual.pdf">
      <PdfViewer style={{ height: "100vh" }} />
    </PdfDocument>
  );
}

PdfDocument opens the document and provides a viewer for everything inside it; PdfViewer is a scroll container that shows it. Give the viewer a definite height: it does not grow with the document. Nothing suspends, and the viewer shows no loading state or error of its own; read them with useDocumentState().

Controls inside PdfDocument read the viewer and its state directly:

import { PdfDocument, PdfViewer, useViewer, useViewState } from "parapdf";

function Toolbar() {
  const viewer = useViewer();
  const { currentPage, pageCount } = useViewState();
  return (
    <div>
      <button type="button" onClick={() => viewer.previousPage()}>Previous</button>
      <span>{currentPage + 1} / {pageCount}</span>
      <button type="button" onClick={() => viewer.nextPage()}>Next</button>
      <button type="button" onClick={() => viewer.zoomBy(1.25)}>Zoom in</button>
    </div>
  );
}

export function Reader() {
  return (
    <PdfDocument source="/manual.pdf">
      <Toolbar />
      <PdfViewer style={{ height: "80vh" }} />
    </PdfDocument>
  );
}

Bundlers

ParaPDF refers to pdf.js's worker and files with new URL(…, import.meta.url), which Vite, webpack, Rsbuild, and Next.js (Turbopack and webpack) copy to the build output as they are. With bundlers that do not, such as Parcel, esbuild, and Bun, copy node_modules/parapdf/pdfjs/ to where your application serves static files and tell ParaPDF where it is:

configurePdfjs({ assetBase: "/pdfjs/" });

Bundlers covers Content Security Policy and files served from another origin.

Documentation

License

Apache License 2.0. Parts of ParaPDF are derived from pdf.js: see NOTICE.md.