I’m adding the workerSource
pdfjsLib.GlobalWorkerOptions.workerSrc = './pdf.worker.js';
but still showing this warning in the console Setting up fake worker.
It works only when referencing the original file in github
pdfjsLib.GlobalWorkerOptions.workerSrc = '//mozilla.github.io/pdf.js/build/pdf.worker.js';
Advertisement
Answer
I had the issue because I already had an instance of the pdfWorker created when the file pdf.worker.js was loaded, I fixed it by adding this globalThis.pdfjsWorker = null;
just before setting the workerSrc
Like this I was able to create a new instance with the local file