No PDFJS.workerSrc specified error on using pdfjs-dist package from npm
See original GitHub issuefunction usage(blob) {
console.log('usage called!');
var fileReader = new FileReader();
fileReader.onload = function (blob) {
require('pdfjs-dist');
var fs = require('fs');
PDFJS.getDocument(blob.target.result).then(function (pdfDocument) {
console.log('Number of pages: ' + pdfDocument.numPages);
});
}
fileReader.readAsArrayBuffer(blob);
}
implemented as shown in the example for node, but throws error for not specifying workingSrc. I’m using content scripts for a chrome extension which disallow document.currentscript as fcfort commented in this issue
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:10 (3 by maintainers)
Top Results From Across the Web
No PDFJS.workerSrc specified - Stack Overflow
I had a similar error and I fixed it by specifying the pdf.worker.js explicitly at the end of the pdf.js if (!PDFJS.workerSrc &&...
Read more >Error: No PDFJS.workerSrc specified (#16) · Issues - GitLab
Trying to use pdf-parse in Electron and it returns this error: ...\node_modules\pdf-parse\lib\pdf.js\v1.10.100\build\pdf.js:4011 Uncaught ...
Read more >How to use the pdfjs-dist.GlobalWorkerOptions function in ...
To help you get started, we've selected a few pdfjs-dist. ... Use Snyk Code to scan source code in minutes - no build...
Read more >react-pdf - npm
React-PDF. Display PDFs in your React app as easily as if they were images. Lost? This package is used to display existing PDFs....
Read more >Examples
Remember though that PDF.js uses promises, and the above will return a ... exports. var pdfjsLib = window['pdfjs-dist/build/pdf']; // The workerSrc property ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This absolutely worked for me, except I’m using native
import
.You should try this: