React pdf handler

React pdf handler allows to render a PDF and handle text selection and highlights.

Version: 1.0.1 Updated: 11/17/2020

By: konz License: Apache-2.0

Install

npm i react-pdf-handler
yarn add react-pdf-handler

CDNs

bundle.run: https://bundle.run/react-pdf-handler

jsDelivr: https://cdn.jsdelivr.net/npm/react-pdf-handler

unpkg: https://unpkg.com/react-pdf-handler

How to use

Clone this repo to your local computer, then run:

  • yarn install & yarn build

  • To make this component available to other projects on your local computer, run yarn link.

  • Then go to the project where you want to use this package and run yarn link "react-pdf-handler".

Finally, to fix the multiple copies of React bug that shows up with linked React packages:

  • navigate to the root of the react-pdf-handler package
  • run npm link "../path/to/your/project/node_modules/react"
  • run npm link "../path/to/your/project/node_modules/react-dom"

You can now import PdfHandler as a normal package installed from npm like so:

import PdfHandler from 'PdfHandler'
...

You can also import the type definitions if you're using TypeScript like so:

import PdfHandler, { IPdfHandlerProps } from 'PdfHandler'
...

Compiling with babel

yarn babel -D -d dist/ src/* --extensions ".ts,.tsx"

Using module in other project

yarn add file:PATH/react-pdf-handler

Categories: React js