How can we get updated coordinates(x,y,height,width) of rectangle annotation as the rectangle moves on the page of pdf?

WebViewer Version:

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

Please give a brief summary of your issue:
(Think of this as an email subject)
Regarding rectangle annotation

Please describe your issue and provide steps to reproduce it:
(The more descriptive your answer, the faster we are able to help you)

I want to get the coordinates of the rectangle on pdf. As the rectangle moves on the pdf the coordinates should update accordingly. Also is customization possible in rectangle annotation, Can I dynamically show a person’s details in the rectangle?

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:


Hello maryam.bashir,

You can do something like this by listening for the annotationChanged event in your app.

Here is a general example of how it could work:

  const { annotationManager } = instance.Core;

  const onAnnotationChanged = (changedAnnotation) => {
    console.log('X: ', changedAnnotation.X, 'Y: ', changedAnnotation.Y, 'Height: ', changedAnnotation.Height, 'Width: ', changedAnnotation.Width);

  annotationManager.addEventListener('annotationChanged', (annotations, action) => {
    const annotation = annotations[0];
    if (action === 'modify') {

Hope this helps!

Best Regards,

Carlo Mendoza
Software Developer
PDFTron Systems, Inc.

Thanks for the quick response. It worked for me.
Can you please guide me about the customization in the existing annotation, is it possible to show dynamic data in the annotation?

Hello maryam.bashir,

We have a lot of guides on customizing annotations available here: PDFTron Systems Inc. | Documentation

There is also a guide available which might be helpful in storing custom data here: PDFTron Systems Inc. | Documentation

Best Regards,

Carlo Mendoza
Software Developer
PDFTron Systems, Inc.