Trying to use PDF JS in a local Apache server and receiving the following error in console:
Uncaught Error: No PDFJS.workerSrc specified
Th
I added below code in end of pdf.js and working fine
if (!PDFJS.workerSrc && typeof document !== 'undefined') {
PDFJS.workerSrc = (function () {
'use strict';
var scriptTagContainer = document.body ||
document.getElementsByTagName('head')[0];
var pdfjsSrc = scriptTagContainer.lastChild.src;
return pdfjsSrc && pdfjsSrc.replace(/\.js$/i, '.worker.js');
})();
PDFJS.workerSrc = 'pdf.worker.js';
}