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

Error with embed PDF

New Here ,
Mar 06, 2022 Mar 06, 2022

Copy link to clipboard

Copied

I have seen many similar posts, but even with much trouble shooting I can't seem to get the PDF embed code to work. Have created multiple API keys, but won't work.

 

Here is the code I'm using

 

<html>

<head>

  <title>Your title</title>

  <meta charset="utf-8"/>

  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>

  <script src="http://documentcloud.adobe.com/view-sdk/main.js"></script>

</head>

<body>

  <div id="adobe-dc-view"></div>

  <script type="text/javascript">

   document.addEventListener("adobe_dc_view_sdk.ready", function()

   {

      var adobeDCView = new AdobeDC.View({clientId: "99546d4b3c424396afeb3522fdd20b62", divId: "adobe-dc-view"});

      adobeDCView.previewFile(

     {

         content:  {location: {url: "(http://pccirls.weebly.com/uploads/1/3/5/4/135443943/pdf_test.pdf"}},

         metaData: {fileName: " pdf_test.pdf "}

     });

   });

  </script>

</body>

</html>

Views

780

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 , Mar 08, 2022 Mar 08, 2022

Your client ID was created with the www prefix but the url you are trying to use Embed API from is not. They have to match.

Votes

Translate

Translate
New Here ,
Mar 06, 2022 Mar 06, 2022

Copy link to clipboard

Copied

The PDF I can see is viewable online without issue. But yet the embed code doesn't work on the website.

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
New Here ,
Mar 06, 2022 Mar 06, 2022

Copy link to clipboard

Copied

Lastly, even when I use the demo code. I still get this error.

 

<div id="adobe-dc-view" style="height: 360px; width: 500px;"></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: "99546d4b3c424396afeb3522fdd20b62", divId: "adobe-dc-view"});

                             adobeDCView.previewFile({

                                           content:{location: {url: "https://documentcloud.adobe.com/view-sdk-demo/PDFs/Bodea Brochure.pdf"}},

                                           metaData:{fileName: "Bodea Brochure.pdf"}

                             }, {embedMode: "SIZED_CONTAINER"});

              });

</script>

 

 

 

Brian2346730683jf_0-1646630906808.png

In preview mode

 

 

 

 

Brian2346730683jf_1-1646630947311.png

 

In published mode

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 Expert ,
Mar 08, 2022 Mar 08, 2022

Copy link to clipboard

Copied

It just looks like you are not using a proper client ID. Your code works perfectly fine for me with my ID.

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
New Here ,
Mar 08, 2022 Mar 08, 2022

Copy link to clipboard

Copied

1.png

 

2.png

4.png

 

 

 

 

It looks like it is set up appropriately?

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
New Here ,
Mar 08, 2022 Mar 08, 2022

Copy link to clipboard

Copied

I created that Client ID brand new in case there was some issue. And here is the code in text format.

 

 

<div id="adobe-dc-view" style="height: 360px; width: 500px;"></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: "ab014f3b7d4b4a6092ee37c37179ab1f", divId: "adobe-dc-view"});

                             adobeDCView.previewFile({

                                           content:{location: {url: "https://documentcloud.adobe.com/view-sdk-demo/PDFs/Bodea Brochure.pdf"}},

                                           metaData:{fileName: "Bodea Brochure.pdf"}

                             }, {embedMode: "SIZED_CONTAINER"});

              });

</script>

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 Expert ,
Mar 08, 2022 Mar 08, 2022

Copy link to clipboard

Copied

Your client ID was created with the www prefix but the url you are trying to use Embed API from is not. They have to match.

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
New Here ,
Mar 14, 2022 Mar 14, 2022

Copy link to clipboard

Copied

LATEST

Yes! Thank you! It works!

 

After I got the source code to work with the test file it was easy to use the code to use my own file.

 

You are the best.

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