0

My web app contains many links to various pdf files which are stored in Amazon S3. When I click on these links, the pdf file is downloaded even though my in browser, default, pdf viewer is enabled. If I install a third party pdf viewer, this fixes the problem, but I don't want my users to have to install an extension.

I tried adding each pdf link to the Google Docs pdf viewer url, but because these S3 pdf files are protected by their bucket policy, this doesn't work. I am 100% sure my default pdf viewer is enabled correctly, it works for other pdfs on the internet.

Has anybody run into this bizarre problem? Could I fix this with PDF.js? I am pretty sure the source of the problem is due to the pdf files being uploaded to S3 using http requests and not via the s3 client, but I still have no idea how to fix this.

Hiding
  • 278
  • 1
  • 3
  • 19
  • It really hard to find a good React library that use PDF.js -- the recommendation is to use modified PDF.js demo viewer in the iframe. – async5 Aug 15 '17 at 14:58
  • Looks like you are experiencing CORS issue, see https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-xhr and probably https://stackoverflow.com/questions/37364662/pdf-js-message-file-origin-does-not-match-viewers-amazon-s3 – async5 Aug 15 '17 at 15:00

1 Answers1

0

I was able to upload PDF.js to my s3 bucket and concatenate the viewer.html to the pdf links on my apps, now everybody can view pdfs in browser without having an extension

Hiding
  • 278
  • 1
  • 3
  • 19