Skip to main content
Participating Frequently
September 6, 2021
Question

PDF Embed API - File preview not available

  • September 6, 2021
  • 1 reply
  • 6295 views

I believe I have checked all related posts. Still this error can not be fixed.

Here is my scripts.

  <div id="adobe-dc-view" style="height: 960px; width: 60%;"></div>
    <script src="https://documentcloud.adobe.com/view-sdk/main.js"></script>
      <script type="text/javascript">
        document.addEventListener("adobe_dc_view_sdk.ready", function(){ 
          var adobeDCView = new AdobeDC.View({clientId: "b925ad5e782c410ba78800c9ec21327c", divId: "adobe-dc-view"});
          adobeDCView.previewFile({
            content:{location: {url: "http://anning.se/unsorted/raw.20210905163612.4032092.pdf"}},
            metaData:{fileName: "raw.20210905163612.4032092.pdf"}
          }, {embedMode: "SIZED_CONTAINER"});
        });
      </script>

Credential has been recreated multiple times.

 

The PDF file is reachable.

http://anning.se/unsorted/raw.20210905163612.4032092.pdf

I also tried https, direct, or indirect url.

Any more suggestions? Thanks a lot.

 

This topic has been closed for replies.

1 reply

Joel Geraci
Community Expert
Community Expert
September 9, 2021

Is your credential for "anning.se"? If not, then I think access to the file is being blocked by CORS.

norrlandsAuthor
Participating Frequently
September 9, 2021

Thank you for your reply.

 

My PDFs are stored on anning.se.

I will need to embed them on another website.

In this case, which domain address should the credential be bond to?

norrlandsAuthor
Participating Frequently
September 9, 2021

I figured. It is blocked by CORS.

I added this line to my .htaccess file and it worked.

Header set Access-Control-Allow-Origin "*"

Thanks again.