-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PDF hosted on Amazon S3 doesn't work #2938
Comments
Does Amazon S3 have CORS support? |
It appears it does, and here's a link on how to enable it: http://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html |
I can't reproduce this, since here the pdf is showed :) I'm using Ubuntu 12.04, Nightly and pdd.js development. Can you test with pdf.js development version and told us if this solves 2013/3/13 David Quintana [email protected]
Att, Marcos Paulo de Souza |
I assumed he's using the viewer on his own website, since he's "passing the url" to something. If he was just trying to load the PDF he would have said he's "linking to the pdf" or similar, I guess. Either way, I suppose it needs clarification. Are you trying to use a viewer hosted in your website? Or just linking to the PDF? The extension should be able to load the PDF regardless of origin, but the viewer requires either same-origin, or CORS. |
Ow, understood :) 2013/3/13 David Quintana [email protected]
Att, Marcos Paulo de Souza |
Sorry I didn't provide much information of the issue. I am trying to load the pdf on my website using the canvas tag. Ideally this would be a single page pdf that I want to show on my webpage. I used the following code to acheive this. PDFJS.getDocument('http://d25js2ljnosx0i.cloudfront.net/postingother/1685P-v7ikwh.pdf').then(function(pdf) { I hope this explains the problem. And also thanks for the tip for enabling the CORS on Amazon S3, I will try to use that. |
Still an issue? If yes, provide url to the web page (jsbin or jsfiddle) that contains the code above. |
No response, therefore closing this. Please open a new issue if there are still problems. |
Does anyone have an example of an S3 bucket CORS policy that works? I've tried several to no avail. Currently trying:
|
@andyweiss1982 did you end up finding a solution? |
Hi Guys! I know this topic is old! But I'm facing the same problem, while using ionic 3, with ng2-pdf-viewer which is a wrapper of pdf.js below is cors XML code what I have tried, but no luck so far! And the bug i'm getting is like below the screenshot Can someone help please! |
From what I read on: How Does Amazon S3 Evaluate the CORS Configuration On a Bucket? When Amazon S3 receives a preflight request from a browser, it evaluates the CORS configuration for the bucket and uses the first CORSRule rule that matches the incoming browser request to enable a cross-origin request. For a rule to match, the following conditions must be met:
========== A fix for this will be needed in the pdfjs lib. |
Solution here Use this config on your S3 CORS configuration.
|
Which version of pdfjs do you use? this config doesnt help me for version 2.0.943? |
@gmimaster1945 which platform or framework are you using. U need to provide more details so that we may help you. |
@jjoao07 Thanks for replying. I am using codeigniter framework[PHP] + PDF.js testing the files via amazon aws. it is working via direct read access gave in public but when i remove the permission i got above attached error. accessing files via PHP library of aws s3. i need client side help. |
I resolved this issue by comment this lines in viewer.js if (fileOrigin !== viewerOrigin) { |
I had an issue with CORS as well. Tries every solution possible and it turned out to be a cache problem. I needed to append a random parameter |
Solution provided by GautierT worked for me in PDF.js v.2.4.456. S3 needs CORS policy in JSON: |
@Bveronique check the request to fetch the PDF file, it seems you do not have the proper access to it. |
thanks @Priestch ; other PDFs are okay, they open without any issue; only a serie of PDFs is not, they all are made from an email and content links, and coding samples; other PDFs do not. That issue is for anyone. |
Hello again, I found the solution in the file name, it is NL #1 for example, so in the coding link, I just need to replace # by %23 and it is now opening fine! |
I am passing the url of the PDF file which is stored on Amazon S3 via CDN. But the PDF is not read in the PDF.js. Here is the url of the PDF http://d25js2ljnosx0i.cloudfront.net/postingother/1682P-yxuc78.pdf
The text was updated successfully, but these errors were encountered: