1.0.0 • Published 1 year ago

react-pdfjs-dist v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

react-pdfjs-dist

A react library to render pdf document in html

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

1.0.0

1 year ago