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

Failed to load PDF file

Open sarwaras opened this issue 2 years ago • 8 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

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

sarwaras avatar Mar 23 '22 09:03 sarwaras

Browser (if applicable): Chrome

React PDF version: 5.7.0

Reaction version: 17.0.0

Webpack Version (if applicable): 5.70.0

sarwaras avatar Mar 23 '22 09:03 sarwaras

I have the same problem :(

intchensc avatar Apr 01 '22 11:04 intchensc

It could be a network problem,My can sometimes load files, but sometimes not

sarwaras avatar Apr 02 '22 02:04 sarwaras

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.

paul-altyfc avatar Apr 09 '22 19:04 paul-altyfc

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.

Boniich avatar Apr 09 '22 21:04 Boniich

I found that the second step i.e. importing webpack was enough!

RishiMalhotra920 avatar May 04 '22 22:05 RishiMalhotra920

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: @.***>

sarwaras avatar Jun 17 '22 07:06 sarwaras

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.

github-actions[bot] avatar Sep 19 '22 00:09 github-actions[bot]

This issue was closed because it has been stalled for 14 days with no activity.

github-actions[bot] avatar Oct 03 '22 00:10 github-actions[bot]

@Boniich Importing Webpack Worked for me.Thank you!

AmanTheGreatCoder avatar Feb 10 '23 07:02 AmanTheGreatCoder