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.28k stars 878 forks source link

Online demo not working with the url i passed #1536

Closed chathurvedijarugu closed 1 year ago

chathurvedijarugu commented 1 year ago

Before you start - checklist

Description

when i am passing the browser url of pdf file then that pdf is nor rendering,then i checked with online demo "https://projects.wojtekmaj.pl/react-pdf/test/" but even that demo cant render that pdf file

Steps to reproduce

see error

Expected behavior

image

Actual behavior

image

Additional information

No response

Environment

wojtekmaj commented 1 year ago

Can you pass the actual URL you're trying to use?

siddharthshankarpaul commented 1 year ago

@wojtekmaj here is one URL i tried https://www.africau.edu/images/default/sample.pdf

juzarantri commented 1 year ago

how can i fetch pdf data and pass?

juzarantri commented 1 year ago

please provide code snippet I am not getting where am I stucked

wojtekmaj commented 1 year ago

That test page is not really intended for the public, but since you're playing with it, you must learn about CORS policy and how browsers handle cross origin requests. More on that on Google, but basically, you can't just request any data from any server and expect it to work. The server needs to be configured to allow, via special HTTP headers, certain origins to request data from itself.

ZeeshanAhmadKhalil commented 6 months ago

It's giving Cors error on every PDF.

Showkiip commented 6 months ago

@wojtekmaj Hello, we are using React + Laravel, and we have resolved the Cors error in whole projects. However, when we use an iframe or embed HTML tag, the PDF still appears. Why is this happening? We need to use this package.