Skip to main content
Participant
March 18, 2021
Answered

Using PDF Embed API with Google Apps Script HtmlService

  • March 18, 2021
  • 1 reply
  • 1341 views

I am trying to use the PDF Embed API on a web app developed with Google Apps Script's HtmlService.

I am using the sample code, with the only change being the updated client ID. When deployed, the error states: "This application domain (https://n-oglre90lc7wy45865lvkriotploicflop75k7o-ppu-script.googleusercontent.com) is not authorized to use the provided PDF Embed API Client ID." When adding the domain to the credential, the url was flagged as invalid with "https://", so I removed the "https://" and it allowed me to enter the domain. The error persists. Can this tool be used with the GAS's HtmlService? If so, how should the domain be entered?

 

<div id="adobe-dc-view"></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: "<YOUR_CLIENT_ID>", 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"}
       });
    });
 </script>

 

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

Create a new credential using just "googleusercontent.com", not the full URL without the protocol. 

1 reply

Joel Geraci
Community Expert
Joel GeraciCommunity ExpertCorrect answer
Community Expert
March 18, 2021

Create a new credential using just "googleusercontent.com", not the full URL without the protocol. 

Participant
March 18, 2021

That did it! Thank you so much.