You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I copy the pdf.worker.js file from node_modules/pdfjs-dist/build/pdf.worker.js to www/js/ and rename the file to app.bundle.worker.js, it works fine.
But ionic will recompile the js before build so this is not a solution. I try to trace the error stack and find some clue:
pdf.js (line 9565)
var PDFWorker = (function PDFWorkerClosure() {
var nextFakeWorkerId = 0;
function getWorkerSrc() {
if (typeof workerSrc !== 'undefined') {
return workerSrc;
}
if (getDefaultSetting('workerSrc')) {
return getDefaultSetting('workerSrc');
}
if (pdfjsFilePath) {
return pdfjsFilePath.replace(/\.js$/i, '.worker.js');
}
error('No PDFJS.workerSrc specified');
}
Ionic2 will compile all js and ts to a single js file called app.bundle.js. The reason why getting "app.bundle.worker.js" is because of the
if (pdfjsFilePath) {
return pdfjsFilePath.replace(/\.js$/i, '.worker.js');
}
trying to change pdf.js -> pdf.worker.js but failed in this scenario and changed app.bundle.js -> app.bundle.worker.js
That what I knew so far and got stuck. Got no idea how to solve this. Any help or guidance would be appreciated.
The text was updated successfully, but these errors were encountered:
@nessgor, Meanwhile, you could also try for now to use pdfjs-dist/build/pdf.combined.js instead of pdfjs-dist/build/pdf.js which has a fake web worker.
You are welcome! I can't find any modules to display PDF file for ionic2 but angular2 module should work with ionic2 also. It would be great if this directive can support ionic2.
I followed your instruction for installation, and can import PdfViewerComponent in typescript file
pdf.ts
pdf.html
And the chrome dev tools shows the following
If I copy the pdf.worker.js file from node_modules/pdfjs-dist/build/pdf.worker.js to www/js/ and rename the file to app.bundle.worker.js, it works fine.
But ionic will recompile the js before build so this is not a solution. I try to trace the error stack and find some clue:
pdf.js (line 9565)
Ionic2 will compile all js and ts to a single js file called app.bundle.js. The reason why getting "app.bundle.worker.js" is because of the
trying to change pdf.js -> pdf.worker.js but failed in this scenario and changed app.bundle.js -> app.bundle.worker.js
That what I knew so far and got stuck. Got no idea how to solve this. Any help or guidance would be appreciated.
The text was updated successfully, but these errors were encountered: