Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
11

Problem: PDF Embed API dc-core loaded twice

New Here ,
Jul 15, 2023 Jul 15, 2023

Hi,

yesterday my PDF Embed API stopped working properly for no reason.

If I load it more than once in the same page, without refreshing, it gives me the error 'index.js:44 Uncaught dc-core loaded twice'.

I didn't edit anything about it.

 

This is the code:


               <script type="text/javascript">
                var pdfurl = <?php echo json_encode($pdfUrl ?? null) ?>;
                var pdfname = <?php echo json_encode($pdfName ?? null) ?>;
                document.addEventListener("adobe_dc_view_sdk.ready", function(){
                    var adobeDCView = new AdobeDC.View({clientId: ".............", divId: "adobe-dc-view"});
                    adobeDCView.previewFile({
                        content:{location: {url: pdfurl}},
                        metaData:{fileName: pdfname}
                    }, {defaultViewMode: "FIT_PAGE", showAnnotationTools: false, showLeftHandPanel: true,
                        dockPageControls: true});
                });
               </script>
 

This is the log: 

 

index.js:44 Uncaught dc-core loaded twice
haRa @ index.js:44
__webpack_require__ @ bootstrap:19
EbfC @ AdobeDCViewBase.js:13
__webpack_require__ @ bootstrap:19
(anonymous) @ ViewSDKInterface.js:2
(anonymous) @ ViewSDKInterface.js:2
(anonymous) @ ViewSDKInterface.js:2

 

Any suggestions gratefully received.

Cheers, Daniel

TOPICS
PDF Embed API , PDF Services API
11.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Feb 01, 2024 Feb 01, 2024

I'm on the road this week, but will try to look early next week.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 27, 2024 Apr 27, 2024

The following snippet is what is causing the error for me. Is there something wrong with this check? How do I properly setup the sdk in my react app so that I don't trigger this error? My use case involves loading a pdf document and re render it whenever the pdf has been updated.

// Check that dc-core has been built properly
window.adobe_dc_sdk = window.adobe_dc_sdk || {};
if (window.adobe_dc_sdk['dc-core-loaded']) {
  // normally this means that dc-core has been statically linked
  throw 'dc-core loaded twice';
}
window.adobe_dc_sdk['dc-core-loaded'] = true;
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 27, 2024 Apr 27, 2024
LATEST
      window.adobe_dc_sdk = window.adobe_dc_sdk || {};
      window.adobe_dc_sdk['dc-core-loaded'] = false;


For now I am doing this and it's working fine. I am not sure about the potential issues that can arise. If there is anything, kindly let me know. Thanks!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 02, 2024 Apr 02, 2024

Any update on this yet, I am also facing the same issue.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 27, 2024 Apr 27, 2024

Not sure how relevent this is, but while I was trying to delete the script element I noticed that it's parentNode is null and as per my reading that could be an issue with the library?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources