PDF Embed API -> Viewer API -> gotoLocation method stopped working suddenly
Copy link to clipboard
Copied
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-...
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?
Copy link to clipboard
Copied
Hi - I was about to post the same. We have also noticed that this feature no longer works.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
I 100% agree versioning should be added - we've logged this internally as something that should be considered.
As to why it started worked, we reverted the last update.
Copy link to clipboard
Copied
Is there a public changelog that we can see the updates?
Copy link to clipboard
Copied

