Display PDF file inside Angular component using ng
I'm the developer of ngx-extended-pdf-viewer.
Short story: you have to add the pdf.worker.js file as an asset:
"assets": [ { "glob": "**/pdf.worker.js", "input": "node_modules/ngx-extended-pdf-viewer/assets", "output": "/assets/" }, ... }]Long story:
Until recently, I recommended adding all three files to the scripts section: pdf.js, pdf.worker.js, and viewer.js. A couple of week ago, I found out that while this solution works, it's far from being ideal. It's better not to include the service worker with the bundle. It has been design to be lazy-loaded. That's why I've moved the file from the scripts section to the assets section.
You're rewarded by superior performance. Loading the service worker lazily allows it to run in a separate thread. So the user benefits from non-blocking I/O and non-blocking rendering. That's a remarkable performance boost, especially with large documents above the 200 pages mark.