react-pdfjs-dist
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

react-pdfjs-dist

A react library to render pdf document in html

npm version Downloads Paypal

Install

Install the component using NPM:

$ npm install --save react-pdfjs-dist

Install the component using YARN:

$ yarn add react-pdfjs-dist

Usage

import React, { useEffect, useRef } from 'react';
import { useReactPdf } from 'react-pdfjs-dist';

const App = () => {
  const ref = useRef(null);
  const { renderPdf } = useReactPdf({ containerRef: ref });

  useEffect(() => {
    renderPdf('http://localhost:3000/sample_document.pdf');
  }, [renderPdf]);

  return (
    <div className="App">
      <div className="pdf-container" ref={ref} />
    </div>
  );
}

License

MIT License

Package Sidebar

Install

npm i react-pdfjs-dist

Weekly Downloads

4

Version

1.0.0

License

MIT

Unpacked Size

7.51 kB

Total Files

8

Last publish

Collaborators

  • praveenkumar-outlook