Skip to main content
Participating Frequently
November 24, 2020
Question

Cannot perform DCAPI command if DCAPI is disabled

  • November 24, 2020
  • 2 replies
  • 1351 views

Just trying to get started with the basics:

I copied the 'Copy it Run it' code into our application.

var adobeDCView = new AdobeDC.View({ clientId: "OUR 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"}
});


When it runs the spinner shows 'Opening Document 100%' but it throws an error a Promise rejection 'Cannot perform DCAPI command if DCAPI is disabled'.

If I click through all the Promise rejections the pdf does eventually display, though any mouse move over the pdf generates more Promise rejections.

I must be missing something obvious???

I also tried using our own pdf with the url pointing at our AWS location, the spinner shows 'Opening Document 0%' then the promise rejection, the pdf never loads

    This topic has been closed for replies.

    2 replies

    Participant
    October 15, 2024

    I am also facing the same problem. Did you find out any workaround? 

     

    Raymond Camden
    Community Manager
    Community Manager
    October 15, 2024

    What browser are you using? Is your example online where we can see?

    Participant
    October 16, 2024

    I am using Chrome (Version 129.0.6668.90). The example is not available to the internet but I can share you my code.  

     

    Here is the Javascript code, 

    function initializeAdobeDCView (clientId, divId, pdfUrl, pdfFileName) {
        try {
            if (typeof AdobeDC !== 'undefined') {
                var adobeDCView = new AdobeDC.View({
                    clientId: clientId,
                    divId: divId
                });
    
                adobeDCView.previewFile({
                    content: { location: { url: pdfUrl } },
                    metaData: { fileName: pdfFileName }
                },
                    {
                        showDownloadPDF: true,
                        showPrintPDF: true
                    });
            } else {
                console.error("AdobeDC is not loaded");
            }
        }
        catch(e) {
            console.error(e);
        }
    }

    It does not even goes to the catch block. 

    I have imported the sdk like this,

    <script src="https://documentcloud.adobe.com/view-sdk/main.js"></script>

    and my div for this,

    <div id="adobe-dc-view" style="width: 100%; height: 500px"></div>

     

     

    Participating Frequently
    November 24, 2020

    Haven't been able to resolve the promise rejection but our pdf is now rendering I think it just renders very slow in the viewer.

    In Chrome native all 6 pages render almost instantly, in PDFJS  it renders in a few seconds but in the Adobe viewer it is taking minutes and several pages are incorrectly or partially rendered.

    https://drive.google.com/file/d/1e8xqFCX4ddkWk-6EDngDBXJoPcWc9gtp/view?usp=sharing 



     

     

    Participating Frequently
    November 24, 2020

    The partial rendering seems to just be a question of timing, wait long enough and it seems to sort itself out.
    It also seems this maybe more of an issue with the inline mode.