Square annotation - interpreting xml "rect" attribute

WebViewer Version:

Do you have an issue with a specific file(s)? no
Can you reproduce using one of our samples or online demos? Yes
Are you using the WebViewer server? No
Does the issue only happen on certain browsers? No
Is your issue related to a front-end framework? Yes
Is your issue related to annotations? Yes

Please give a brief summary of your issue:
I want to understand what the rect of square annotation represent.

Please describe your issue and provide steps to reproduce it:
getAnnotCommand gives the following xml … how do i interpret the rect field - is it x,y, width, height or something else?

Please provide a link to a minimal sample where the issue is reproducible:

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:


Hi anandchavan,

As per the PDF specification, the Rect property of an annotation defines the location of the annotation on the page in default user space units, which basically is the bounding rectangle of the annotation. The return value for getRect is two sets of coordinates, representing the top left and bottom right coordinates of the bounding rectangle on the page. If you wish to learn more about the coordinate space you can read about it here

If you wish to get the width and height of a rectangle annotation, you can simply use the methods getWidth or getHeight .

Best Regards,

Armando Bollain
Software Developer
PDFTron Systems, Inc.