question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IE11 not able to load PDFJS worker

See original GitHub issue

Before you start - checklist

  • I followed instructions in documentation written for my React-PDF version
  • I have checked if this bug is not already reported
  • I have checked if an issue is not listed in Known issues
  • If I have a problem with PDF rendering, I checked if my PDF renders properly in Mozilla Firefox

Description

IE11 does not render PDFs with 5.0.0-beta.3 or latest version 4.1

Steps to reproduce

Steps to reproduce the behavior:

  1. Use IE11
  2. Load any PDF using a URL (or local file)
  3. See the following error Screen Shot 2020-04-30 at 7 56 38 AM

Also noting that with this library I have to add a worker SRC otherwise the PDF will not load.

import { Document, Page, pdfjs } from 'react-pdf'
...
pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js`

Expected behavior

IE11 should load PDF js documents. Also noting that @mikecousins/react-pdf will load. So perhaps there is a method or configuration to support IE11 that is missing.

Additional information

Environment

  • Browser (if applicable) [e.g. Chrome 57, Firefox 59]: IE11 (chrome & firefox have no issue)
  • React-PDF version [e.g. 3.0.4]: 4.1 and also tested on 5.0.0-beta.3
  • React version [e.g. 16.3.0]: 16.13.0
  • Webpack version (if applicable) [e.g. 4.16.2]: 4.42.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
wojtekmajcommented, Sep 7, 2020

Unfortunately, in v5, support for IE 11 has been dropped. There’s nothing we can do about it. Sorry about that!

If you still need to continue support IE 11, you’re stuck at v4.x.

See thread: https://github.com/wojtekmaj/react-pdf/issues/495#issuecomment-662036968

1reaction
david-pulsecommented, Sep 2, 2020

Facing issues with IE11 as well… I do think it needs to be a babel configuration problem… It appears that my webpack configuration is not compiling the react-pdf import of pdfjs-dist to es5.

When I look at the compiled code, it is still using es6 code which is why it’s failing on IE11. It would be great if we could get an IE11 compatible config.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PDF.js not working on IE 11 - Stack Overflow
IE11 doesn't support ES6 format, so some features of PDF. js won't work in IE11. You could try to use the ES5 version...
Read more >
WebViewer not getting loaded in IE 11 - PDF.js Express
Hello Logan, WebViewer is not getting loaded in the IE-11, I have changed my code and make it ECMA-5 supportive due to IE-11...
Read more >
PDFObject: A JavaScript utility for embedding PDFs
PDFObject. An open-source standards-friendly JavaScript utility for embedding PDF files into HTML documents. Why Use PDFObject? Browser Support; API.
Read more >
pdfjs-dist - npm
Generic build of Mozilla's PDF.js library.. Latest version: 3.1.81, last published: a month ago. Start using pdfjs-dist in your project by ...
Read more >
ngx-extended-pdf-viewer/README.md - UNPKG
38, Not to mention the ability to display PDF files, running on Mozilla's ... `ng2-pdfjs-viewer` are they also support Internet Explorer 11 (with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found