Skip to main content
Participant
June 12, 2024
Question

Inquiry about code

  • June 12, 2024
  • 1 reply
  • 333 views

I want to use Adobe PDF Embed API and in this code below I have changed Client ID, fileName 

 And in content: {location: {url: "<Path to your PDF/yourfilename.pdf">}}, if I uploaded my pdf to Google drive and copied the url to it, do I have to paste the link here and then put / and write a file name pdf followed by .pdf Is this true?

 The other thing is, do I have to change other things in the code or just what I mentioned?

 

 

<html>

<head>

  <title>Your title</title>

  <meta charset="utf-8"/>

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

  <script src="https://acrobatservices.adobe.com/view-sdk/viewer.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: "<YOUR_CLIENT_ID>", divId: "adobe-dc-view"});

      adobeDCView.previewFile(

     {

         content: {location: {url: "<Path to your PDF/yourfilename.pdf">}},

         metaData: {fileName: "yourfilename.pdf"}

     });

   });

  </script>

</body>

</html>

<!--Get the samples from https://www.adobe.com/

go/pdfembedapi_samples-->

    This topic has been closed for replies.

    1 reply

    Raymond Camden
    Community Manager
    Community Manager
    June 12, 2024

    You can't use a URL for Google Drive unless it *directly* points to the PDF. Ie, you paste it into a browser tab and see ONLY the pdf, not any Google Drive UI around it. I'm pretty sure Google Drive doesn't support this.

    Participant
    June 12, 2024
    Well, what is the correct solution?
    Raymond Camden
    Community Manager
    Community Manager
    June 13, 2024

    You need to write code to interface with Google Drive and provide public access to the bits. We can't do that for you, nor can Embed. I wrote up a blog post on the topic (exposing GD files) a while ago: https://www.raymondcamden.com/2022/09/17/building-a-web-view-of-a-public-google-drive-folder