Skip to main content
Participant
March 13, 2024
Question

PDF Embed API -> Viewer API -> gotoLocation method stopped working suddenly

  • March 13, 2024
  • 4 replies
  • 1892 views

Hi,

We used the PDF embed API to view the PDF on an angular page and used the gotLocation() method to move to a particuler page after PDF loaded. I used the below code as mentioned in the https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-open-pdf-with-jump-to-particular-page-in-embed-adobe-api/td-p/384277

 

 

pdfFilePromise.then(adobeViewer => {
          console.log('file rendered')
          if (this.item.pageId) {
            console.log('opening page', this.item.pageId)
            adobeViewer.getAPIs().then((apis: any) => {
              apis.gotoLocation(this.item.pageId)
                .then((data) => {console.log("Page opening Success");
                   console.log(data) })
                .catch((error: any) => console.log('Page opening error', error));
            });
          }
}

 

 

The PDF loading successfully, but not going to the given page. Even I am getting "data" value as "true" in the then function of the gotoLocation method. But PDF is not moving the given page. Always showing the first page.

 

It works fine from last 3 months, but today it stopped suddenly.  It stopped working in all environments even we deployed any thing from last 1 month. 

 

Now also it is coming t 

 

Is there any changes made in Adobe side? 

This topic has been closed for replies.

4 replies

Participating Frequently
March 14, 2024

It appears that the functionality is now working again, but I would be very interested to know why and what happened over the last 24 hours to have caused this to happen and how Adobe can mitigate this in future. Perhaps versioning the library would be a good start?

Participating Frequently
March 14, 2024

I had a quick look at the `viewer.js` file source code itself and it appears there are version numbers managed within this script, look at the values there for latest, public, legacy, etc:

(()=>{"use strict";var e={r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t);const c=Object.freeze({latest:"3.22.5_3.2.4-c0d25b1b",public:"3.21.0_3.2.3-d6687df8",legacy:"3.21.0_3.2.3-d6687df8",edit:"2.24.4_2.12.0-7d0a8c15"});!function loadSDKScript(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"latest.js",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.latest,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"View",d=Array.from(document.scripts),r="view-sdk/".concat(e),i=d.find((function(e){return e.src&&e.src.endsWith(r)})).src,o=i.substring(0,i.indexOf(e)),s="".concat("".concat(o+t,"/").concat(n),"SDKInterface.js"),a=document.createElement("script");a.async=!1,a.setAttribute("src",s),document.head.appendChild(a)}("viewer.js",c.public),window.adobe_dc_view_sdk=t})();
//# sourceMappingURL=3.22.5_3.2.4-c0d25b1b/private/viewer.js.map

 

Participant
March 13, 2024

We are running into the same issue. The goToLocation api is not working as expected. We are also seeing this adobe error in the console. Using the page navigation in the viewer works but we have some links that uses the goToLocation api that is not working.

dc-core.js:2 Error in Logging serverHandler: 
AdobeError
code
: 
0
details
: 
{status: 0, statusText: 'Timeout or network error', headers: {…}, content: ''}
message
: 
"Timeout or network error"
stack
: 
"AdobeError: Timeout or network error (0)\nDetails: {\"status\":0,\"statusText\":\"Timeout or network error\",\"headers\":{},\"content\":\"\"}\n    at new AdobeError (https://documentcloud.adobe.com/dc-core/3.22.5/dc-core.js:2:75903)\n    at $.onreadystatechange (https://documentcloud.adobe.com/dc-core/3.22.5/dc-core.js:2:78686)"
[[Prototype]]
: 
Error

 

Raymond Camden
Community Manager
Community Manager
March 13, 2024

I'm not able to replicate this issue. Do make sure that item.pageId is a page _number_. This is my last demo using this functionality, https://codepen.io/cfjedimaster/pen/KKxQErd?editors=1011. It uses speech recognition so it's a bit complex, but it's working for me.

Participant
March 13, 2024

It's not working with embedMode "FULL_WINDOW". I have modified your codepen to use "FULL_WINDOW" embed mode and was able to replicate the issue.

Participating Frequently
March 13, 2024

Hi - I was about to post the same. We have also noticed that this feature no longer works.