pdfjs-viewer-element
A web component for viewing pdf files in the browser. The package is based on PDF.js viewer build and works with any framework. 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 download and place the prebuilt files to some directory of your project. You may specify the path to this directory with viewer-path
property (/pdfjs
by default).
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
Place PDF.js prebuilt files to some directory of your project (pdfjs
used as the standard name). See demo example. You may call the directory as you want, but then you should specify the viewer-path
property.
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 (/pdfjs
by default).
locale
- language localization (e.g. 'en', 'en-US', 'es', 'de'), see pdf.js i10n files (the language of your browser by default)
License
For this package - MIT.
For the pdf.js
library - https://github.com/mozilla/pdf.js/blob/master/LICENSE.