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

Adobe pdf embed- goToLocation timing problem

Explorer ,
Sep 18, 2021 Sep 18, 2021

Copy link to clipboard

Copied

Hi,

I have a case in which i have to select an annotation whithin APP_RENDERING_DONE event. The annotation is being selected but when I'm trying to call the goToLocation function within annotation selected event, nothing happens. In debug mode, everything works fine.

please advise...

Views

494

Translate

Translate

Report

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 ,
Sep 19, 2021 Sep 19, 2021

Copy link to clipboard

Copied

When i add setTimeout, it works:

goToAnnotationLocation(annotation){
const PDFCoordinatePPI = 72;
const screenHeightInch = Math.round(screen.height / getPPI());
const page = parseInt(annotation.target.selector.node.index, 10) + 1;
const xCoordinate = parseInt(annotation.target.selector.boundingBox[0], 10);
const yCoordinate = (screenHeightInch * PDFCoordinatePPI) - parseInt(annotation.target.selector.boundingBox[3], 10);

console.log('before this.createAdobeViewerPromise');
this.createAdobeViewerPromise.then((view) => {
view.getAPIs().then((apis) => {
setTimeout(() => apis.gotoLocation(page, xCoordinate, yCoordinate - 5), 500);
}).catch((err) => Error.send(err.message, err.code, { failureLocation: 'PDF: Adobe embed sdk: getAPIs failed' }));
}).catch((err) => Error.send(err.message, err.code, { failureLocation: 'PDF: Adobe embed sdk: goToAnnotationLocation failed' }));
}

Votes

Translate

Translate

Report

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 Expert ,
Sep 20, 2021 Sep 20, 2021

Copy link to clipboard

Copied

I'm glad you founsd something that works but the selectAnnotation API should shift the focus to the selected annotation automatically. You shouldn't have to even use goToLocation. Is that not working for you?

Votes

Translate

Translate

Report

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 ,
Sep 22, 2021 Sep 22, 2021

Copy link to clipboard

Copied

LATEST

This is a workaround for a bug i reported to you guys. when PDF is in fit to width state and the page is longer than the screen. when i select an annotation programatically, it's not scrolling to the relevant annotation. That's why i added this.

Votes

Translate

Translate

Report

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