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

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

Explorer ,
Sep 23, 2020 Sep 23, 2020

Copy link to clipboard

Copied

Screenshot_2020-09-23 Comments and Markup — Document Cloud View SDK.pnghttps://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?

TOPICS
How to , PDF Embed API

Views

1.5K

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

correct answers 1 Correct answer

Community Expert , Sep 24, 2020 Sep 24, 2020

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 p

...

Votes

Translate

Translate
Adobe Employee ,
Sep 23, 2020 Sep 23, 2020

Copy link to clipboard

Copied

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-configura... 

Thanks,
Shubhanshu

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 23, 2020 Sep 23, 2020

Copy link to clipboard

Copied

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.

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
Adobe Employee ,
Sep 23, 2020 Sep 23, 2020

Copy link to clipboard

Copied

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?

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 23, 2020 Sep 23, 2020

Copy link to clipboard

Copied

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 23, 2020 Sep 23, 2020

Copy link to clipboard

Copied

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#M70...

`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!

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
Adobe Employee ,
Sep 23, 2020 Sep 23, 2020

Copy link to clipboard

Copied

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

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 23, 2020 Sep 23, 2020

Copy link to clipboard

Copied

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#M70...

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

Copy link to clipboard

Copied

LATEST

I think i found a workaround, i also tested it both on desktop & ipad resolution, not actual device:

Pay attension to screenHeightInch calculation instead of hardcoded 11 inch

With this func u can get the PPI:

export const getPPI = () => {
const div = document.createElement('div');
div.style.width='1in';
const body = document.getElementsByTagName('body')[0];
body.appendChild(div);
const ppi = document.defaultView.getComputedStyle(div, null).getPropertyValue('width');
body.removeChild(div);
return parseFloat(ppi);
};

Usage to with goToLocation:
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);
apis.gotoLocation(page, xCoordinate, yCoordinate)
 

 

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 24, 2020 Sep 24, 2020

Copy link to clipboard

Copied

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.

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
New Here ,
Jan 18, 2021 Jan 18, 2021

Copy link to clipboard

Copied

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

 

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 ?

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

Copy link to clipboard

Copied

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.

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