I used pdf.js directly in angular app for some pdf purposes. It works fine.
I imported the pdfjs from the pdfjs-dist and my package.json includes pdfjs-dist.
This is because you did not set the GlobalWorkerOptions.workerSrc
property. Normally you set it to the URL from where the pdf.worker.js
or pdf.worker.min.js
file can be loaded. If you installed the pdfjs-dist
packages it is in the same folder as pdf.js
.
Try it out, as soon as you set the property the warning goes away.
PDFJS.GlobalWorkerOptions.workerSrc =
"./node_modules/pdfjs-dist/build/pdf.worker.js";
In production you should load it from a CDN URL.