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 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-pdfjs-multi

v0.5.1

Published

React wrapper for pdfjs with multiple file support

Downloads

83

Readme

react-pdfjs-multi

Build Status David Dependencies Coverage Status

React wrapper for pdfjs with multiple file support.

This library uses pdf.js.

For a preview of the current development visit github pages.

What does in development mean:

  1. MINOR versions represent breaking changes
  2. PATCH versions represent fixes and features
  3. There are no deprecation warnings between releases

Installation & Usage

yarn add react-pdfjs-multi

or

npm i react-pdfjs-multi

Example Usage MultiViewer:

import React from 'react';
import { PdfMultiViewer } from 'react-pdfjs-multi';
import 'react-pdfjs-multi/dist/react-pdfjs-multi.css';

const MultiViewerExample = () => {
  const pdfFiles = [
    'pdfs/test-pdf-a.pdf',
    {
      title:
        'Trace-based Just-in-Time Type Specialization for DynamicLanguages',
      source: 'pdfs/compressed.tracemonkey-pldi-09.pdf',
    },
    'pdfs/test-pdf-b.pdf',
    'pdfs/test-pdf-c.pdf',
  ];

  return (
    <PdfMultiViewer
      pdfs={pdfFiles}
      i18nData={{
        download: 'Herunterladen',
        scaleDown: 'Verkleinern',
        scaleUp: 'Vergrößern',
        originalSize: 'Originalgröße',
        pages: 'Seiten',
        zoom: 'Automatischer Zoom',
      }}
    />
  );
};

export default MultiViewerExample;

Example Usage Renderer (Typescript)

import React, { FC, useState, useEffect } from 'react';
import { PdfRenderer, PdfjsLib, PDFDocumentProxy } from 'react-pdfjs-multi';

PdfjsLib.GlobalWorkerOptions.workerSrc =
  '//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.5.207/pdf.worker.js';

const RendererExample: FC = () => {
  const [pdfDoc, setPdfDoc] = useState<PDFDocumentProxy>();

  useEffect(() => {
    const getPdfDoc = async () => {
      const doc = await PdfjsLib.getDocument({
        url: 'pdfs/compressed.tracemonkey-pldi-09.pdf',
      }).promise;

      setPdfDoc(doc);
    };

    getPdfDoc();
  }, []);

  if (!pdfDoc) return null;

  return <PdfRenderer pdfDoc={pdfDoc} downloadBtn={false} />;
};

export default RendererExample;

PdfMultiViewer

The MultiViewer allows you to pass an array of source strings or an object definition and it then loads all PDF's async and shows the renderer as soon as the first PDF is loaded.

Props:

| Name | Required | Default | Type | Description | | ---------- | -------- | ------- | ---------- | -------------------------------------------------------------- | | pdfs | true | | {array} | An array of strings or objects | | autoZoom | | true | {boolean} | enables/disables autoZoom on component mount and window resize | | controls | | true | {boolean} | enables/disables controls to e.g. change renderer zoom | | i18nData | | {}* | {I18nData} | An object of translated strings, default language is en | | startIndex | | 0 | {number} | first pdf to load using array index |

i18n

To be able to use different i18n libraries eg. i18next or react-intl you can pass an i18n object with translated strings to the component.

*defaults:

{
  // Viewer
  pages: 'Pages',
  // Renderer
  zoom: 'Automatic zoom',
  originalSize: 'Original size',
  rotateLeft: 'Rotate left',
  rotateRight: 'Rotate right',
  scaleUp: 'Scale up',
  scaleDown: 'Scale down',
  download: 'Download',
}

PdfRenderer

If you like to implement your own custom multi renderer logic you can use the PdfRenderer component. For an implementation example see Example.

Props:

| Name | Required | Default | Type | Description | | ------------- | -------- | ------- | ------------------ | -------------------------------------------------------------- | | pdfDoc | true | | {PDFDocumentProxy} | A proxy of the pdf document to display | | autoZoom | | true | {boolean} | enables/disables autoZoom on component mount and window resize | | controls | | true | {boolean} | enables/disables controls to e.g. change renderer zoom | | downloadBtn | | true | {boolean} | enables/disables download button | | i18nData | | {}* | {I18nDataRenderer} | An object of translated strings, default language is en | | zoom | | null | {number} | Initial Zoom | | rotation | | null | {number} | Initial Rotation | | scrollTop | | null | {number} | Initial ScrollTop | | scrollLeft | | null | {number} | Initial ScrollLeft | | activeIndex | | null | {number} | Is required whenn the pdfChangeHook is used | | pdfChangeHook | | null | {func} | Callback function which gets a position object |