wojtekmaj / react-pdf

Display PDFs in your React app as easily as if they were images.
https://projects.wojtekmaj.pl/react-pdf
MIT License
9.11k stars 867 forks source link

Setting up fake worker failed: "Cannot read properties of undefined (reading 'WorkerMessageHandler')" #1697

Closed Mani-RDev closed 5 months ago

Mani-RDev commented 6 months ago

Before you start - checklist

Description

const MyPdfViewer = (base64) => { return ( <Document file={data:application/pdf;base64,${base64)}

        </Document>
        );
   };

Steps to reproduce

const MyPdfViewer = (base64) => { return ( <Document file={data:application/pdf;base64,${base64)}

        </Document>
        );
   };

I tried to render Pdf But i Can't Below error are getting in console

Expected behavior

PDF Should View In a Another component That i use MyPdfViewer this method.

Actual behavior

image Screenshot 2024-01-17 185030

Additional information

No response

Environment

  • Browser (if applicable):
  • React-PDF version:
  • React version:
  • Webpack version (if applicable):
Mani-RDev commented 6 months ago

i'm trying to render here const rootElement = document.getElementById("root"); ReactDOM.render( , rootElement);

aleksbobic commented 5 months ago

Hi @wojtekmaj I'm encountering the same issue. My Webpack config is the default electron-react-boilerplate. It works perfectly fine when loaded via CDN so I assume it's a Webpack issue. But I am not sure how to debug this further. Any pointers would be very much welcome! 😄

wojtekmaj commented 5 months ago

Duplicate of #677