Skip to main content
Participant
Jun 12, 2024 9:35 PM UTC
Question

Inquiry about code

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 is closed to new replies. Start a new post to keep the conversation going.

    3 replies

    Raymond Camden
    Community Manager
    Community Manager
    Jun 12, 2024 9:40 PM UTC

    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.

    Translate
    Participant
    Jun 12, 2024 10:22 PM UTC
    Well, what is the correct solution?
    Translate
    Raymond Camden
    Community Manager
    Community Manager
    Jun 13, 2024 2:31 PM UTC

    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

    Translate