[pdf embed api] viewer API function goToLocation() doesn't match the annotation boundingBox

Explorer ,
Aug 24, 2021 Aug 24, 2021

Copy link to clipboard

Copied

Hi, 

 

Currently the annotationManager.SelectAnnotation() function only navigates to the top of the annotation's page. if the annotation is at the bottom of the page, it won't be shown sometimes if the browser height is not large enough. 

 

So I try to use the viewer.goToLocation() API to manually implement the selectAnnotation() function. 

 

But I noticed that the 

selectAnnotation(<page_number>, <x_coord>, <y_coord>)

 does NOT match the annotation's bounding Box schema. 

 

In the annotation's boundingBox data, the x and y values seem to be starting from the bottom left corner of the page, the x_coord and y_coord arguments in selectAnnotation() function seem to be starting from the top left corner. 

 

so the x_coord is working as expected, but the y_coord is reversed. 

 

If I can query the height of the page, I can do selectAnnotation(page_num, x_coord, page_height - y_coord).  But unfortunately I don't know how. 

 

So what's happening is that if I have a annotation that's at the top of the page, then when I use the selectAnnotation, the viewer will focus at the bottom of the page instead. 

 

Please kindly advise. 

 

thanks. 

TOPICS
PDF Embed API

Views

59

Likes

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
no replies

Have something to add?

Join the conversation
Resources