Django AWS S3 pdf Embed Integration

Community Beginner ,
May 03, 2021 May 03, 2021

Copy link to clipboard

Copied

Hi,
I've successfully integrated pdf Embed API on my local machine, but I want to use S3 as bucket.
It's failing from some reason.

My aws s3 CORS is:

[
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "GET",
            "HEAD",
            "POST",
            "PUT"
        ],
        "AllowedOrigins": [
            "*"
        ],
        "ExposeHeaders": []
    }
]

 

And I tried once with Adobe Credential on which allowed domain is 'localhost', and once with 'django-02-files.s3.amazonaws.com'.

 

Both didn't work for me..

Any suggestion will be helpful !

Thanks !

 

P.s-

I well aware that currectly all my aws keys are in the JS code, it will be the next thing that i will fix.

(I'm a fresh CS Grad that builds my first project)

TOPICS
How to, PDF Embed API

Views

78

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 03, 2021 May 03, 2021

Copy link to clipboard

Copied

The Error is:

File preview error: File preview not available, please reload to try again.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 03, 2021 May 03, 2021

Copy link to clipboard

Copied

Just make the AWS file public.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 03, 2021 May 03, 2021

Copy link to clipboard

Copied

I'm considering it, but there are some strange behaviour.

In the same page I included the user image, which is also in the same s3 bucket (different folder).

You can see the Image, but not the pdf file.

 

I tried to solved it for 4-5 hours, and thought that the problem is in the pdf embed api, but now I'm confused..

 

I will try it.

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 05, 2021 May 05, 2021

Copy link to clipboard

Copied

LATEST

I changed the bucket to public - Still not working.

I've take another step further - I used bootstrap5 ratio class - and it is loading the pdf file.

 

So:

Using aws s3 to store the pdf files is not working with the API. But working with a simple html tag.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines