Skip to main content
Participating Frequently
March 7, 2022
Answered

Error with embed PDF

  • March 7, 2022
  • 1 reply
  • 1546 views

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>

    This topic has been closed for replies.
    Correct answer Joel Geraci

     

     

     

    It looks like it is set up appropriately?


    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.

    1 reply

    Participating Frequently
    March 7, 2022

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

    Participating Frequently
    March 7, 2022

    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>

     

     

     

    In preview mode

     

     

     

     

     

    In published mode

    Joel Geraci
    Community Expert
    Community Expert
    March 8, 2022

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