Skip to main content
Participating Frequently
Nov 24, 2020 12:19 AM UTC
Question

Cannot perform DCAPI command if DCAPI is disabled

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

    6 replies

    Participant
    Oct 15, 2024 5:45 AM UTC

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

     

    Translate
    Raymond Camden
    Community Manager
    Community Manager
    Oct 15, 2024 1:27 PM UTC

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

    Translate
    Participant
    Oct 16, 2024 6:11 AM UTC

    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>

     

     

    Translate
    Participating Frequently
    Nov 24, 2020 3:10 AM UTC

    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 



     

     

    Translate
    Participating Frequently
    Nov 24, 2020 12:52 PM UTC

    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.

    Translate