react-pdfjs-dist
v1.0.0
Published
A react library to render pdf document in html
Downloads
12
Maintainers
Readme
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>
);
}