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

@plp-sergio/react-reader

v0.4.7

Published

A React reader for PDFs and image publications with navigation, zoom, and search.

Readme

React Reader

A React reader for PDFs and image-based publications, with page navigation, zoom, search, thumbnails, and mobile gestures.

Install

npm install @plp-sergio/react-reader

For PDF support, also install:

npm install [email protected]

Supports React 18 and 19. Use a client component in Next.js.

Open a PDF or publication

'use client';

import { Reader } from '@plp-sergio/react-reader/reader';
import '@plp-sergio/react-reader/styles.css';

export default function Book() {
  return (
    <Reader
      src="/books/example.pdf"
      title="My publication"
      locale="en"
      style={{ height: '100dvh' }}
    />
  );
}

src accepts a PDF path or an edition folder such as /publications/publication-id/edition-id/. Folder mode first tries an optional publication.json manifest, then the supported numbered image, BIN, and PDF naming conventions. Missing or unusable manifests fall back automatically, preserving the current page. Direct PDF URLs still open the PDF first. Image editions prepare a buffer of ten pages around the starting spread (or every page in shorter editions), then open the reader and continue warming the remaining images and text in the background. The loading screen shows preparation stages and actual page progress.

For PDF rendering, serve the matching PDF.js files from /pdfjs/: pdf.worker.min.mjs from its build/ directory, plus the cmaps/, standard_fonts/, wasm/, and iccs/ directories. Set pdfAssetsUrl if you use a different location. The PDF dependency requires Node 22.13+ or 24+.

Open image pages

import { Flipbook } from '@plp-sergio/react-reader';
import '@plp-sergio/react-reader/styles.css';

<Flipbook
  title="My publication"
  locale="en"
  pages={[
    { src: '/books/page-1.jpg', alt: 'Cover' },
    { src: '/books/page-2.jpg', alt: 'Page 2' },
  ]}
/>

Image-only use does not require PDF.js. Search needs supplied page text or extractable PDF text; the reader does not perform OCR.

Clickable page links

Edition and PDF readers automatically try the optional UI_Zine.xml file beside the publication. By default, they use its clickable page links while keeping the reader's normal toolbar, navigation, and appearance. Missing or invalid XML does not stop reading.

For a direct image list, pass uiConfigUrl="/books/UI_Zine.xml" to Flipbook. Set uiConfigMode="full" to apply its configured controls and styling. Use uiConfigUrl={false} to skip the file entirely. Edition loading, PDF rendering and XML integration are supported parts of the main reader.

Page changes use a 3D paper bend with the page artwork and painted text together. Three.js loads on the first animated turn; indexed geometry and a bounded texture cache are reused, with no rendering at rest. Single pages, spreads and right-to-left reading retain the existing navigation controls. Reduced motion and disabled page animation skip the renderer. When WebGL is unavailable or cross-origin artwork cannot safely become a texture, the existing DOM transition remains available. Hosted images can also use the bend when their server permits anonymous CORS access; the overlay tries that separately without changing the displayed image request. Servers that deny CORS retain the fallback transition. Moving surfaces use a 1.5 pixel-ratio cap and smaller shadows; resting pages keep their original rendering.

Common options

| Option | Purpose | | --- | --- | | title | Publication name. | | locale | es (default), en, or auto. | | initialPage | Starting page, numbered from 1. | | onPageChange | Receive the current page number. | | initialTheme | portal, paper, sepia, or night. | | initialPageTurnAnimation | Enable or disable page transitions. |

After the visible pages finish loading, image readers warm nearby pages first and then continue through the publication with at most two background requests. Navigation gives the new page priority. Split PDFs warm remaining files after preparing nearby pages; full PDFs retain PDF.js streaming. Large rendered pages stay in a bounded cache. Configure HTTP caching on your asset host so downloaded assets can be reused during later navigation.

Reader also accepts style, className, and pdfAssetsUrl. Flipbook provides controlled page and layout options, callbacks, and navigation methods through a ref.

Hosting

Use your own document and asset paths. Cross-origin files must allow the browser's requests. Keep private publications behind your application's access controls. The reader does not provide authentication or host documents.

CloudFront testing example

For a phone or another device on the same network, open the CloudFront / LAN URL printed by npm run dev. You can add &publicationId=421&issueId=10205 to open an issue directly. The dev server listens on all network interfaces.

Run npm run dev and open http://localhost:5173/?cloudfront. Enter a publication ID and issue ID to load https://d37w6g2wghq2wf.cloudfront.net/{publicationId}/{issueId}/ with the existing automatic reader. Submitting updates the page URL so you can share or reload the same issue; submitting again reloads it.

You can also open http://localhost:5173/?cloudfront&publicationId=YOUR_PUBLICATION&issueId=YOUR_ISSUE directly. The development server serves the installed PDF.js assets for PDF fallback. Remote assets must allow browser cross-origin requests. Open / for sample pages, /?open for a manifest URL or file, or /?src=<publication-url> for automatic source selection.

Advanced usage

The reference guide covers edition folders, manifests, text layers, migration, and the full API. It is also included in the installed package at docs/REFERENCE.md.

License

MIT. Document content, images, and fonts retain their owners' licenses.