Skip to main content
Participating Frequently
November 24, 2020
Answered

adobe_dc_view_sdk.ready

  • November 24, 2020
  • 1 reply
  • 3701 views

Is there some property that can be checked to see if the sdk is ready rather than listening for the event.

 

Would just checking for the existence of  adobeDCView be enough?


Reason for this is because of the way our app is constructed the sdk gets loaded and completes before the code that attaches the listener, so it never hears the event. 

 

Thanks

Rob

    This topic has been closed for replies.
    Correct answer Shubhanshu Dixit

    You can check the PDF Embed API initialization in the following way as well

                if (window.AdobeDC) {
                    previewFile();
                } else {
                    /* Wait for Adobe Document Services PDF Embed API to be ready */
                    document.addEventListener("adobe_dc_view_sdk.ready", () => {
                        previewFile();
                    });
                }

    1 reply

    Joel Geraci
    Community Expert
    Community Expert
    November 24, 2020

    You can't rewrite that section?

    Participating Frequently
    November 24, 2020

    Yeah I decided to rewrite it in the end and load the script dynamically in our PDFAdapter class.
    Thanks

    Rob

     

    Shubhanshu DixitCorrect answer
    Adobe Employee
    December 3, 2020

    You can check the PDF Embed API initialization in the following way as well

                if (window.AdobeDC) {
                    previewFile();
                } else {
                    /* Wait for Adobe Document Services PDF Embed API to be ready */
                    document.addEventListener("adobe_dc_view_sdk.ready", () => {
                        previewFile();
                    });
                }