Skip to main content
Inspiring
Sep 23, 2020 2:43 PM UTC
Answered

selector.boundingBox and selector.quadPoints - What do they mean, what is the point of reference?

https://www.adobe.com/devnet-docs/dcsdk_io/viewSDK/howtos_comments.html#annotation-schema

 

`selector.boundingBox` and `selector.quadPoints` - What do they mean, what is the point of reference?

 

When I use them in

await apis.gotoLocation(pageNumber, 0, here);
 

I can't hit with an annotation position.

I want the top edge of the viewer to be flush with the top of the annotation.

 

How to do it?

Joel Geraci
Joel GeraciCorrect answer
Community Expert
Sep 24, 2020 3:49 PM UTC

Is this CodePen showing the behavior you were looking for?

The PDF coordinate system is based on 72 points per inch. In order to make a selected annotation scroll to the top of the window, you need to know the page size but there's no API to get it at this time. You have to know it ahead of time but it's fairly simple to preprocess the PDF and add that information to a metadata field that you can access via Embed API. An 11 inch tall page is 792 points high. You then calculate the Y_Coordinate position for gotoLocation by subtracting the 4th item in the bounding box from the page height.

14 replies

Participant
Jan 19, 2021 3:22 AM UTC

Hello,
anyone know how to get highlighted text using any one of below 

 

actually, i want a highlighted text with a comment added by the user. I got all comment using this method 

 annotationManager.getAnnotations() but i can not get the highlighted text. i got value of boundbox and quadpoints. have you any idea about this ?
Translate
Joel Geraci
Community Expert
Community Expert
Jan 19, 2021 6:24 PM UTC

Embed API does not currently have any methods of retrieving the text within a given bounding box or list of quads. You can, however, use these input values for another API that can parse PDF.

Translate
Joel Geraci
Community Expert
Joel GeraciCommunity ExpertCorrect answer
Community Expert
Sep 24, 2020 3:49 PM UTC

Is this CodePen showing the behavior you were looking for?

The PDF coordinate system is based on 72 points per inch. In order to make a selected annotation scroll to the top of the window, you need to know the page size but there's no API to get it at this time. You have to know it ahead of time but it's fairly simple to preprocess the PDF and add that information to a metadata field that you can access via Embed API. An 11 inch tall page is 792 points high. You then calculate the Y_Coordinate position for gotoLocation by subtracting the 4th item in the bounding box from the page height.

Translate
Participant
Apr 2, 2025 3:40 PM UTC

Can we please get any reference how to preprocess the PDF to know what is the height and width of the PDF and add it to metadata?

quote

Is this CodePen showing the behavior you were looking for?

The PDF coordinate system is based on 72 points per inch. In order to make a selected annotation scroll to the top of the window, you need to know the page size but there's no API to get it at this time. You have to know it ahead of time but it's fairly simple to preprocess the PDF and add that information to a metadata field that you can access via Embed API. An 11 inch tall page is 792 points high. You then calculate the Y_Coordinate position for gotoLocation by subtracting the 4th item in the bounding box from the page height.


By @Joel Geraci

 

Translate
Joel Geraci
Community Expert
Community Expert
Apr 2, 2025 5:45 PM UTC

The PDF Properties API can tell you the individual page sizes for every page in the PDF.

Translate
look997Author
Inspiring
Sep 23, 2020 3:33 PM UTC

Conclusions:

`y` are correct if you increase them by 1/3. Similar error here: https://community.adobe.com/t5/document-services-apis/how-get-page-width-and-height/m-p/11451327#M703

`x` are not valid or partially valid - unable to match the annotation position with what is contained in `selector.boundingBox` and` selector.quadPoints`.

 

So these are bugs of this API!

Translate
Adobe Employee
Sep 23, 2020 4:08 PM UTC

Sorry, but your assumptions are not correct. As I mentioned you are mixing two different coordinate systems and making assumptions like increase by 1/3.

Thanks

Translate
look997Author
Inspiring
Sep 23, 2020 5:35 PM UTC

Maybe about selector.boundingBox and selector.quadPoints.


But when it comes to zoom, there's something wrong there. The PDF document I'm using is set to 75% true size when.

`await apis.getPageZoom(1)` returns 1 when the document displays at 75% of its size.

I wrote about it here:
https://community.adobe.com/t5/document-services-apis/how-get-page-width-and-height/m-p/11451327#M703

Translate
Adobe Employee
Sep 23, 2020 2:57 PM UTC

Hi, 
`selector.boundingBox` and `selector.quadPoints` are referred according to the PDF coordinate system, which is different from the View one which you are seeing.
For your use-case,  I would request you to use selectAnnotation API listed under https://www.adobe.com/devnet-docs/dcsdk_io/viewSDK/howtos_comments.html#apis-to-control-ui-configurations 

Thanks,
Shubhanshu

Translate
look997Author
Inspiring
Sep 23, 2020 3:45 PM UTC

When I use:

 

await annotationManager.selectAnnotation(result[0].id);

 

it does not move as I want, but to the edge of the document page.
 
I need to know what position the annotation is in, for example iframe with document viewer.
Translate
Adobe Employee
Sep 23, 2020 4:12 PM UTC

Yes, this API is intended to select the annotation and shift the focus by bringing it back to the view if not.

Can you please tell us more about what you are trying to achieve?

Translate