Failed to load PDF file when using Next.js #1032
Replies: 3 comments
-
Have you tried using different text encodings, specifically base64? If nothing works, try preserving the Node.js object and manually convert it to uint array on the frontend and pass it. |
Beta Was this translation helpful? Give feedback.
-
In your code, you defined The correct Once you fix this, you'll be hit by another issue. You can't run React-PDF in SSR, as you can't really render canvas on the server side. So, to fix this, you'll need to asynchronously load React-PDF after mount (which happens only on browser side). |
Beta Was this translation helpful? Give feedback.
-
Same problem Failed to load pdf |
Beta Was this translation helpful? Give feedback.
-
Before you start - checklist
Description
When downloading a pdf file, it appears warnings in console and Failed to load PDF file

https://codesandbox.io/s/react-pdf-example-6ikmdn?file=/pages/index.tsx
Steps to reproduce
Expected behavior
Correct loading PDF File
Actual behavior
Failed to load PDF file

Additional information
No response
Environment
Beta Was this translation helpful? Give feedback.
All reactions