• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Can't show PDF file preview using Embed API - CORS

New Here ,
Feb 16, 2021 Feb 16, 2021

Copy link to clipboard

Copied

Hi, I'm working on a React project where I want to display a PDF preview in a component. The pdf source comes from Firebase Storage. I'm passing the url from firebase. The thing is that when I render the component, my console is showing a CORS error saying that the request was blocked by CORS policy.

 

I have read the documentation and I know that I need to enable CORS headers on my pdf resource. I have already done that but it doesn't seem to work. 

misael5C58_0-1613543534691.png

This is the error

This is my ViewSdkClient.js code

misael5C58_1-1613543592774.png

I have searched for similar posts on this community but i failed to find a solution

 

I'm not sure if I might be missing something or if my syntax might be wrong.

 

Could you please help me? Thanks!!

Views

3.0K

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

correct answers 1 Correct answer

Community Expert , Feb 17, 2021 Feb 17, 2021

You have to allow your website origin on the PDf resource which in this case is Firebase Storage. I had the same issue with Google Cloud Storage so I used their admin panel to allow my demo site and everything worked as expected. I'm sure Firebase has a similar admin panel. 

Votes

Translate

Translate
Community Expert ,
Feb 17, 2021 Feb 17, 2021

Copy link to clipboard

Copied

You have to allow your website origin on the PDf resource which in this case is Firebase Storage. I had the same issue with Google Cloud Storage so I used their admin panel to allow my demo site and everything worked as expected. I'm sure Firebase has a similar admin panel. 

Votes

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 ,
Nov 22, 2021 Nov 22, 2021

Copy link to clipboard

Copied

LATEST

Hi Joel,

 

I'm trying to use Google cloud storage to make my embed on Squarespace work. I've enabled public access to the bucket the files live in. Is there anything else I need to do?

 

Here's my code: 

 

<div id="adobe-dc-view" style="height: 360px; width: 500px;"></div>
<script type="text/javascript">
document.addEventListener("adobe_dc_view_sdk.ready", function(){ 
var adobeDCView = new AdobeDC.View({clientId: "cdb98ffb676e44ac880d48fed629fc00", divId: "adobe-dc-view"});
adobeDCView.previewFile({
metaData:{fileName: "Alex_FINAL.pdf"}
}, {embedMode: "SIZED_CONTAINER"});
});
</script>
 
Thanks

Votes

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
Resources