Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get pdf.js working with edge #11816

Closed
zerr0s opened this issue Apr 17, 2020 · 3 comments
Closed

Can't get pdf.js working with edge #11816

zerr0s opened this issue Apr 17, 2020 · 3 comments

Comments

@zerr0s
Copy link

zerr0s commented Apr 17, 2020

Configuration:

  • Web browser and its version: Edge 44.18362.449.0
  • Operating system and its version: Windows 10
  • PDF.js version: 2.5.95

Steps to reproduce the problem:

  1. git clone ...
  2. npm install
  3. gulp generic
  4. Place the generic folder in an apache server
  5. Access to the URL

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 : c218e94)
Message : The browser/environment lacks native support for critical functionality used by the PDF.js library (e.g. ReadableStream and/or Promise.allSettled); please use an ES5-compatible build instead.

If I test with gulp server directly, all browser are working. Any idea please ?

@Snuffleupagus
Copy link
Collaborator

Snuffleupagus commented Apr 17, 2020

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/or Promise.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

@zerr0s
Copy link
Author

zerr0s commented Apr 17, 2020

Thanks !!! I'll try asap

[EDIT] It's working with all browsers. Thanks. I did not find any documentation about generic-es5

@zerr0s zerr0s closed this as completed Apr 17, 2020
@BartusZak
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants