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

@unn4m3dd/react-pdfjs-viewer

v1.1.0

Published

Pdfjs viewer package for react

Downloads

5

Readme

react-pdfjs-viewer

Pdfjs viewer package for react

NPM JavaScript Style Guide

Install

yarn add @unn4m3dd/react-pdfjs-viewer

or

npm install @unn4m3dd/react-pdfjs-viewer

Usage

This snippet should give you a headstart on using react-pdfjs-viewer

import { PDFJSViewer } from 'react-pdfjs-viewer'
const App = () => {
  <PDFJSViewer url="/test.pdf"/>
}

Keep in mind that you need to host this pdf since regular CORS rules apply.

For further details of how to unlock the full potential of pdfjs I would suggest that you check out the source code for this simple pdf viewer: simplescreenrecorder-2022-01-27_18 50 37

PDFJSViewer Props

| Property | Type | Default | Description | |----------|:-------------:|:------:|------| | url | string | must be provided | The url from which the pdf will be loaded | | initialPage | number | 1 | The initial page when pdf is opened | | pageInfo | { currentPage: number, setCurrentPage: SetStateFunction } | undefined | If provided, these react state variables are always in sync with the pdf viewer state. This means that reading from currentPage retrieves the currently displayed page and calling setCurrentPage changes the currently displayed page | | initialScale | number | 1 | The initial scale when pdf is opened | | scaleInfo | { currentScale: number, setCurrentScale: SetStateFunction } | undefined | If provided, these react state variables are always in sync with the pdf viewer state. This means that reading from currentScale retrieves the currently displayed scale and calling setCurrentScale changes the currently displayed scale | | onEventName | EventPayload | undefined | If provided it will be called whenever the event occurs |

Supported Events

If you know of any event that is not listed here but that is supported by pdfjs-viewer feel free to submit an issue or a pull request addressing that!
All events return it's source, a PDFViewer, as part of their payload | Property | Payload | |-|-| |onBaseViewerInit | - | |onPageChanging | { pageNumber: number, pageLabel: string \| null, previous: number }| |onRotationChanging | { pagesRotation: number, pageNumber: number } | |onPagesDestroy |-| |onScrollModeChanged |{ mode: PDFScrollMode }| |onPagesLoaded |{ pagesCount: number }| |onPagesInit |-| |onScaleChanging |{ scale: number, presetValue: string }| |onUpdateViewArea |{ scale: number, location: { pageNumber: number, scale: number \| null, top: number, left: number, rotation: number, pdfOpenParams: string } }| |onOptionalContentConfigChanged |{ promise: Promise<any> }| |onSpreadModeChanged |{ mode: PDFSpreadMode }|

PDFScrollMode = { UNKNOWN: -1; VERTICAL: 0; HORIZONTAL: 1; WRAPPED: 2 }
PDFSpreadMode = { UNKNOWN: -1; NONE: 0; ODD: 1; EVEN: 2 }

License

MIT © Unn4m3DD