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
9.4K
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 ,
Jul 17, 2023 Jul 17, 2023

We're getting the same issue, nothing changed on the server just started happening.

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 ,
Jul 17, 2023 Jul 17, 2023

Does the error go away if you have the script tag only once on your page? I mean the one loading 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
New Here ,
Jul 18, 2023 Jul 18, 2023

Tried this but no luck, either doesn't load and no error or doesn't load and errors.

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 ,
Jul 17, 2023 Jul 17, 2023

I have been having the same issue since the 14th as well.  Most of my larger PDFs with annotations do not load.  I have tested it with samller image based PDF files and those have been able to load.  Been attempting to troubleshoot but have not found a resolution yet.

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
Explorer ,
Jul 18, 2023 Jul 18, 2023

I am also seeing this, I utilize the embed on an LMS, and have the core loading each time an embed is on a page, if i have subsequent pages that i move through it stops loading properly and a refresh must occur for it to display, am wondering if a variable could be set to check if the core is already loaded first before it try's a second time?

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 ,
Jul 18, 2023 Jul 18, 2023

@CSumner102 You can check for window.AdobeDC.

@TylerL24 Your comment - are you ONLY talking about cases where the script tag is loaded twice? If not, please open a new thread.

@Crew31128935gi26 So do you get the error with 2 + embeds, even if you have 1 script tag?

 

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
Explorer ,
Jul 18, 2023 Jul 18, 2023

@Raymond Camden yes i was getting the dc-core loaded twice in the console, I just edited my code to this

 

<script type="text/javascript">
  function initializeAdobeDCView() {
    var adobeDCView = new AdobeDC.View({clientId: "Your ID", divId: "adobe-dc-view"});
    adobeDCView.previewFile({
      content: {
        location: {url: "Your File URL"}
      },
      metaData: {fileName: "Your File Name"}
    }, {
      embedMode: "FULL_WINDOW",
      defaultViewMode: "FIT_WIDTH",
      showFullScreen: true,
      showAnnotationTools: false,
      showZoomControl: true,
      focusOnRendering: true,
      showDownloadPDF: true
    });
  }
  function loadViewerScript() {
    if (window.AdobeDC && window.AdobeDC.View) {
      initializeAdobeDCView();
    } else {
      var viewerScript = document.createElement('script');
      viewerScript.src='https://documentservices.adobe.com/view-sdk/viewer.js';
      viewerScript.onload = initializeAdobeDCView;
      document.body.appendChild(viewerScript);
    }
  }
  loadViewerScript(); // Load the Adobe DC View SDK and initialize the viewer
</script>

 

and now it checks to see if the core is already loaded before it try's to again.

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
Explorer ,
Jul 18, 2023 Jul 18, 2023

This is still an issue, the code i have above is fine as a temporary fix, but i have 400 web pages that have the embed on and to implement this code on all these pages is going to take me some time, and i am sure i will still see some other issues.

What exactly has happened to cause this, up to a couple of weeks ago this was not an issue for our platform..

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
Explorer ,
Jul 18, 2023 Jul 18, 2023

looking at the online guide i see that the library is <script src="https://acrobatservices.adobe.com/view-sdk/viewer.js"></script> has it been changed?

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 ,
Oct 05, 2023 Oct 05, 2023

Is there a way to revert to the old script, similar to how the last version in the link works, for example, like jQuery

src="https://acrobatservices.adobe.com/view-sdk/viewer.js"

 src="jquery-3.7.1.min.js">

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 ,
Oct 05, 2023 Oct 05, 2023

Nope.

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 ,
Oct 05, 2023 Oct 05, 2023
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 ,
Oct 05, 2023 Oct 05, 2023

I understand why you want it, but we don't support it.

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 ,
Oct 06, 2023 Oct 06, 2023

So any solution about that problem or Adobe Embed will be without steakyNote ?

 

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 ,
Oct 06, 2023 Oct 06, 2023

I do not have new information for you.

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 ,
Jul 18, 2023 Jul 18, 2023

I'm still a bit confused as to what is causing this. You had 2 script tags, and 2 uses of embed, on a page, right? Can you maybe build a one page demo you can share the code with so I can recreate the 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
Adobe Employee ,
Jul 18, 2023 Jul 18, 2023

As for the URL, yes, it's a new URL, but the library has not changed, outside of what is documented here: https://developer.adobe.com/document-services/docs/overview/pdf-embed-api/releasenotes/

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
Explorer ,
Jul 18, 2023 Jul 18, 2023

from what i can tell the lms loads the <script src="https://documentservices.adobe.com/view-sdk/viewer.js"></script> and my embed code, on my first page, and when I navigate to another page that has a different PDF embedded on and also the <script src="https://documentservices.adobe.com/view-sdk/viewer.js"></script> it then show a blank embed, no loading of the content or anything, and when i check the console it says dc-core loaded twice, its like something is being held onto when the next page is loaded

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 ,
Jul 18, 2023 Jul 18, 2023

Well, I can't really help unless you have a reproducable case. If your CMS is doing something weird, it's possible it worked before but won't now. Basically, I need an HTML page that demonstrates the issue and I can either suggest a workaround, or file a bug report.

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
Explorer ,
Jul 18, 2023 Jul 18, 2023

It seems we have caused some confusion among us. There has been an inadvertent mix-up between the Learning Management System (LMS) and the Content Management System (CMS). As someone with two decades of experience in the field of technology, I believe it is crucial to clarify this distinction.

Now, let's turn our attention to the real issue at hand. It is not directly related to the platform we are currently utilizing or the development environment we are working within. Instead, my focus lies on the integration of the Adobe embed API into our HTML pages, a reliable approach that I have successfully implemented for over 2.5 years.

So to address this effectively, I have decided to replicate the entire setup in an alternate environment. In doing so, I can grant you access, enabling you to observe the situation firsthand. By collaborating in this manner, we can perhaps identify and resolve the issue that has presented itself.

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
Explorer ,
Jul 19, 2023 Jul 19, 2023

Ok just realized I can send you to here https://learn.forcepoint.com/pages/microlearning-catalog, this is a catalog of articles and videos we have that are public, so if you click on any of the items referred to as HackStacks, this will load a page where we have an embedded pdf, it may or may not load the first time, and then if you navigate back with the browsers back button to the catalog again and click a different HackStack you will probably see in the console the error: Uncaught dc-core loaded twice

A refresh on these pages will generally make the pdf display, but again navigate to another HackStack and it will be blank and the error will be in the console. This is what our customers are now reporting to us, and we have over 400 of these across our site, up to a couple of weeks ago we did not have this 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
Explorer ,
Jul 18, 2023 Jul 18, 2023

sorry i meant Uncaught dc-core loaded twice'.

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 ,
Jul 18, 2023 Jul 18, 2023

We are running into the same issue. We have our PDF viewer in a side modal. If a user closes then opens that side modal a second time. `Uncaught dc-core loaded twice` error shows and the viewer does not work. We remove the script tag when the user closes the modal. But now it looks like we also have to remove the following from the window object to clean up what the script adds.

  • window.AdobeDC
  • window.adobe_dc_sdk
  • window.adobe_dc_view_sdk
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 ,
Jul 18, 2023 Jul 18, 2023

@Carl the enforcer As with CSumner102, I need a reproducable case in order to help.

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