I'm using PDF.JS for loading pdfs. While loading pdf, i'm getting this error,
ERROR Error: Unknown action from worker: undefined
at Worker.MessageHandler._onComObjOnMessage (pdf.js:6846)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
at Object.onInvokeTask (core.js:28122)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:503)
at invokeTask (zone.js:1671)
at Worker.globalZoneAwareCallback (zone.js:1697)
undefined es from actionHandler
In pdf.js:6846
const action = this.actionHandler[data.action];
if (!action) {
throw new Error(`Unknown action from worker: ${data.action}`);
}
I took reference from here, ponent.ts
I'm using the worker from .worker.min.js
pdfjsLib.GlobalWorkerOptions.workerSrc = 'assets/js/pdf.worker.min.js';
I'm using PDF.JS for loading pdfs. While loading pdf, i'm getting this error,
ERROR Error: Unknown action from worker: undefined
at Worker.MessageHandler._onComObjOnMessage (pdf.js:6846)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
at Object.onInvokeTask (core.js:28122)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:503)
at invokeTask (zone.js:1671)
at Worker.globalZoneAwareCallback (zone.js:1697)
undefined es from actionHandler
In pdf.js:6846
const action = this.actionHandler[data.action];
if (!action) {
throw new Error(`Unknown action from worker: ${data.action}`);
}
I took reference from here, https://github./jzgoda/ng-pdfjs/blob/master/src/app/app.ponent.ts
I'm using the worker from https://github./jzgoda/ng-pdfjs/blob/master/src/assets/pdf.worker.min.js
pdfjsLib.GlobalWorkerOptions.workerSrc = 'assets/js/pdf.worker.min.js';
Share
edited Jul 29, 2020 at 7:29
Pavithra Muthusamy
asked Jul 29, 2020 at 6:28
Pavithra MuthusamyPavithra Muthusamy
3051 gold badge4 silver badges13 bronze badges
1 Answer
Reset to default 7i got this same error before:
ERROR Error: Unknown action from worker: undefined
and my code is
var pdfjsLib = require("pdfjs-dist/build/pdf.js");
pdfjsLib.GlobalWorkerOptions.workerSrc = 'assets/js/pdf.worker.min.js';
The code does not a problem. My work as upgrading the pdf.js to latest version. During my own operation error, i copied the different version of pdf.js and pdf.worker.min.js, then came out above error. After i prepared a matching version between pdf.js and pdf.worker.min.js. Then this error disappears. This is for your reference.