I am creating a PDF viewer in Ionic 2 using the Mozilla PDF Viewer , but have encountered a problem. I built pdf.js according to these instructions . The generated code contains the following line:
var worker = new Worker(workerSrc);
On this line, Chrome complains that it cannot find the GET http://localhost:8100/build/main.worker.js file GET http://localhost:8100/build/main.worker.js .
Now I have not come across web workers before, so I'm not sure what this error means or where to find or collect this file. I noticed that the build process also gives a file called pdf.worker.js , and I have serious suspicions that it could be a file after it, although renaming it to main.worker.js had no effect.
I am sure this is a very simple problem, if you know. What am I missing?
Well, after a few more digging, I found this one that is more relevant to my situation. I am using Ionic 2 and do not know how to generate the file indicated on this line:
pdfjsLib.PDFJS.workerSrc = '../../build/webpack/pdf.worker.bundle.js';
Can someone light up my dark mind?
source share