Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

196
Views
ngx-extended-pdf-viewer/assets/pdf.js does not exist

In my Angular app, I have installed via npm the ngx-extended-pdf-viewer so that I can display the content of pdf files.

As per instructions, I have included the following in my angular.json file:

"assets": [
  "src/favicon.ico",
  "src/assets",
  {
    "glob": "**/*",
    "input": "node_modules/ngx-extended-pdf-viewer/assets/",
    "output": "/assets/"
  }
],
  "scripts": [
    "node_modules/ngx-extended-pdf-viewer/assets/pdf.js",
    "node_modules/ngx-extended-pdf-viewer/assets/viewer.js",
    "node_modules/ngx-extended-pdf-viewer/assets/pdf.worker.js"
],

However, when I build my app using ng build, I get this error message:

An unhandled exception occurred: Script file node_modules/ngx-extended-pdf-viewer/assets/pdf.js does not exist.

There seems to be only one post on the www that mentions this message, and I don't really understand that...

How can I fix this error?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Nowadays, installing ngx-extended-pdf-viewer has become a lot simpler. You don't need the scripts section. The pdf*.js files are loaded automatically. Your advantage: you benefit from lazy loading, and your PDF viewer is a lot faster.

Technical deep dive: Many users of my library had problems with caching. When I publish a new version, they'd still use the old version of pdf.js. To solve this problem, I've added the version number to the file names. That, in turn, causes your error message.

Not including the JavaScript files has two other advantages. First, the pdf*.js files are only loaded when needed. So your initial bundle is a lot smaller, and the application loads faster. Second, pdf.worker.js is executed in a worker thread. For large PDF files that's a factor ten performance boost.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!