Configuration:
Steps to reproduce the problem:
Hello, I'm trying to setup a pdf viewer on my web site. All is working fine with firefox/google chrome. But Microsoft edge tells me:
PDF.js v2.5.95 (identifiant de compilation : c218e94f)
Message : The browser/environment lacks native support for critical functionality used by the PDF.js library (e.g.ReadableStream
and/orPromise.allSettled
); please use an ES5-compatible build instead.
If I test with gulp server
directly, all browser are working. Any idea please ?
gulp generic
But Microsoft edge tells me:
PDF.js v2.5.95 (identifiant de compilation : c218e94)
Message : The browser/environment lacks native support for critical functionality used by the PDF.js library (e.g.ReadableStream
and/orPromise.allSettled
); please use an ES5-compatible build instead.
The error message is explicitly telling you to use an ES5-compatible build, which based on the quoted gulp
command above you don't seem to do; hence you should use gulp generic-es5
instead.
Generally speaking, it's also strongly advised to use official releases in production (rather than the master
branch directly); see https://github.com/mozilla/pdf.js/releases
Thanks !!! I'll try asap
[EDIT] It's working with all browsers. Thanks. I did not find any documentation about generic-es5
var pdfjsLib = require("pdfjs-dist/es5/build/pdf.js");
var url = 'https://raw.githubusercontent.com/mozilla/pdf.js/ba2edeae/examples/learning/helloworld.pdf';
var loadingTask = pdfjsLib.getDocument(url);
loadingTask.promise.then(function (pdf) {
console.log(pdf);
}).catch(function (error){
console.log(error)
})
That answer saved me like 5h of searching:
Source: https://stackoverflow.com/a/64189798/7027380
Most helpful comment
Thanks !!! I'll try asap
[EDIT] It's working with all browsers. Thanks. I did not find any documentation about generic-es5