Example: Support Internet Explorer 11

In order to support Internet Explorer (IE) 11, add the following polyfills to the entry point of your React application (index.html):

<html>
<head>
    <!-- Polyfills for IE 11 -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.35.3/es6-shim.min.js"></script>
    <script src="https://polyfill.io/v3/polyfill.min.js?features=IntersectionObserver"></script>
</head>
<body>
    <div id="root"></div>
</body>
</html>

For pdf.js v2.6.347

The default build of pdfjs-dist v2.6.347 doesn't support IE 11. So if you are using this version of pdfjs-dist, you have to follow more steps:

  1. Point pdfjs-dist to its ES5 build

    Assume that you're using Webpack to bundle the application, then set pdfjs-dist in the alias key:

    // webpack.config.js
    
    const path = require('path');
    
    module.exports = {
        entry: '...',
        output: {
            ...
        },
        module: {
            ...
        },
        resolve: {
            extensions: ['.js', '.jsx', '.ts', '.tsx'],
            alias: {
                // Point to ES5 build
                'pdfjs-dist': path.resolve('./node_modules/pdfjs-dist/es5/build/pdf.js'),
            },
        },
    };
  2. Set the worker path:

    import { Worker } from '@react-pdf-viewer/core';
    
    <Worker workerUrl='https://unpkg.com/pdfjs-dist@2.6.347/es5/build/pdf.worker.js'>