Many users have been asking for an way to pull pdf files from Amazon S3, So, We did a workaround and identified an way to display PDF Files from Amazon S3 using PDF Viewerf for WordPress Plugin.
PDF Viewer for WordPress can’t pull pdf files from Third party domains due to cross domain policy. But you can pull pdf from third party sites as well, just need to have CORS enabled on the source server. Have a look at the following link for more information about CORS enable-cors.org
By the way, Amazon s3 provides an option to add/edit CORS configuration for each bucket. In this article I’ll show you the way how you can update CORS setting on Amazon s3 to make your pdf’s files accessible by PDF Viewer for WordPress.
1. Login to your s3 management console
2. Enter the bucket you want to change setting of
3. Click on Properties from Top Right Tabs. A section with properties settings will appear on right side
4. Click on Permissions on that section
5. Click on Edit CORS Configuration
6. Put the following codes in the popup editor that will appear after clicking on Edit CORS Configuration:
<CORSConfiguration> <CORSRule> <AllowedOrigin>*</AllowedOrigin> <AllowedMethod>GET</AllowedMethod> <MaxAgeSeconds>3000</MaxAgeSeconds> <AllowedHeader>Authorization</AllowedHeader> </CORSRule> </CORSConfiguration>
7. Click on Save
8. Upload a pdf file inside the bucket.
9. Make sure to change permission of the uploaded file to accessible by everyone
10. Now Copy the pdf file url and go back to your website’s post/page editor. Put the url in any of tnc-pdf-viewer shortcodes and the pdf should appear inside the viewer!
Please feel free to use our support portal if you have any question or need support for any issues.