react-pdf icon indicating copy to clipboard operation
react-pdf copied to clipboard

Getting error while displaying a pdf using base64

Open sourabhchotiads opened this issue 1 month ago • 1 comments

Before you start - checklist

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

Description

I am trying to show a preview of uploaded pdf files and when i integrated this it was working and than i moved the component in an app which is a module fedration app and it stopped working

it always crashes with the error message

Uncaught TypeError: i is not a function at 10045654.js:2:10078 at renderWithHooks (main.js?6559205350d3c6f0efbd:2:210649) at updateForwardRef (main.js?6559205350d3c6f0efbd:2:244599) at beginWork (main.js?6559205350d3c6f0efbd:2:269639) at HTMLUnknownElement._ (main.js?6559205350d3c6f0efbd:2:65358) at Object.invokeGuardedCallbackImpl (main.js?6559205350d3c6f0efbd:2:65695) at invokeGuardedCallback (main.js?6559205350d3c6f0efbd:2:66845) at beginWork$1 (main.js?6559205350d3c6f0efbd:2:328057) at performUnitOfWork (main.js?6559205350d3c6f0efbd:2:312267) at workLoopSync (main.js?6559205350d3c6f0efbd:2:311441)

here is my integration code

<Document
          file={source}
        >
          <Page
            pageNumber={1}
            renderTextLayer={false}
            renderAnnotationLayer={false}
            scale={0.9}
            height={containerHeight}
          />
        </Document>

Steps to reproduce

Pass a base64 string of a pdf to the file prop and it will crash immediately

Expected behavior

It should render the pdf when selected form local machine

Actual behavior

Throwing error

Additional information

No response

Environment

  • Browser (if applicable):
  • React-PDF version:
  • React version:
  • Webpack version (if applicable):

sourabhchotiads avatar May 13 '24 11:05 sourabhchotiads