pdfjs-viewer-element
A web component for PDF.js viewer. See demo.
⚠️ pdfjs-viewer-element
uses PDF.js prebuilt, that includes the generic build of PDF.js and the viewer. To use the package you should extract the prebuilt files into some directory of your project. You may specify the path to this directory with viewer-path
property (by default is '/pdfjs').
Install
npm install --save pdfjs-viewer-element
yarn add pdfjs-viewer-element
or
<script type="module" src="https://cdn.skypack.dev/pdfjs-viewer-element"></script>
Usage
Extract the PDF.js prebuilt. See demo example.
import 'pdfjs-viewer-element'
<pdfjs-viewer-element src="/compressed.tracemonkey-pldi-09.pdf" viewer-path="/path-to-viewer"></pdfjs-viewer-element>
Properties
src
- path to pdf file.
viewer-path
- path to prebuilt directory (by default is '/pdfjs').
License
MIT