This is a mirror of pdfjs-dist, bundled and exposed as an ES module
npm install npm install @bundled-es-modules/pdfjs-dist
<script type="module">
import { pdfjs as pdfjsLib } from '@bundled-es-modules/pdfjs-dist/index.js';
pdfjs.GlobalWorkerOptions.workerSrc = '@bundled-es-modules/pdfjs-dist/build/pdf.worker.js';
var url = "basicapi.pdf";
var loadingTask = pdfjsLib.getDocument(url);
//...
</script>
Rollup to bundle an es module out of pdf.js
. The web worker, pdf.worker.js
is copied as-is from the original repo.
Support for es modules has been requested here, #10317
npm run build