react-pdf
react-pdf copied to clipboard
Failed to load PDF file
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
My goal:
Click the view button to preview the uploaded PDF file
Problems:
Failed to load PDF file is displayed after uploading
Result: the corresponding file cannot be previewed
Ask the big guys to help see what the problem is? Or if someone has encountered such problems, please help me to give instructions
thank you!
Steps to reproduce
Upload PDF file, click the view button to display failed to load PDF file
Expected behavior
Click the view button to preview the uploaded PDF file
Actual behavior
Failed to load PDF file is displayed after uploading
Additional information
I hope to get your help
Environment
浏览器(如果适用):Chrome React-PDF 版本:5.7.0 反应版本:17.0.0 Webpack 版本(如果适用):5.70.0
Browser (if applicable): Chrome
React PDF version: 5.7.0
Reaction version: 17.0.0
Webpack Version (if applicable): 5.70.0
I have the same problem :(
It could be a network problem,My can sometimes load files, but sometimes not
I have the same problem I recently updated to the latest release my code works fine when using v5.3.2 but any version afterwards it fails.
Hi
i had the same problem and fixed it in this way.
-first, i used the version that @paul-altyfc said. 5.3.2
(i was just testing it as a solution, maybe work with another version)
-second, i used this import 'react-pdf/dist/esm/entry.webpack';
-third, i save my pdf in one var and set this var in my document component
import pdf from './somefile.pdf';
<Document file={pdf}> <Page pageNumber={1} /> </Document>
i hope this help you guys.
I found that the second step i.e. importing webpack was enough!
thanks ,it is very helpfor for me
---Original--- From: "Danny @.> Date: Wed, Jun 15, 2022 20:51 PM To: @.>; Cc: @.@.>; Subject: Re: [wojtekmaj/react-pdf] Failed to load PDF file (Issue #971)
I had same issue when try it in my project, And I found a simple solution, just pass an object to the file prop inside the Document component:
<Document file={{ url: 'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf', }} onLoadSuccess={onDocumentLoadSuccess} >
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: @.***>
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this issue will be closed in 14 days.
This issue was closed because it has been stalled for 14 days with no activity.
@Boniich Importing Webpack Worked for me.Thank you!