Can I auto scroll text using quads?

Good day,

I am using the following code to auto-scroll to a specific page:

var page = 2;
instance.Core.documentViewer.setCurrentPage(page, true);

Is it possible to achieve auto-scrolling to a specific page using quads?

Thanks.

Hello mary.j.balagtas,

Yes, you can use the zoomTo() function, this takes in a zoom value, and an X, Y coordinate.
Would this work for you?

Best regards,
Tyler

Hi Tyler,

Thanks for your quick response! I appreciate the information about the zoomTo() function. However, I’m still a bit uncertain about how to obtain the x and y coordinates required for this function.

Could you please guide me on how to retrieve or determine the appropriate x and y values? Any examples or steps would be incredibly helpful.

Thanks again for your assistance!

Hello mary.j.balagtas,

Of course!
Given your initial question, you have a Quad, which is essentially a rectangle of x1, y1, x2, y2,
You can use these coordinates in the zoomTo() function such as:

documentViewer.zoomTo(quad.x1, quad.y1);

This would scroll to the specific x, y viewer value you provide.

If youre trying to zoomTo a specific point on a document you can use:

documentViewer.displayPageLocation(pageNumber, quad.x1, quad.y1);

Let me know if this works for you!

Best regards,
Tyler

Hi Tyler,

I appreciate your prompt response. I have checked the provided function (documentViewer.displayPageLocation(pageNumber, quad.x1, quad.y1)), and it is working as intended. However, I’ve noticed that it scrolls all the way down, whereas I would prefer it to scroll to the middle of the quads. Is there a way to achieve this?

Thanks.

Hello mary.j.balagtas,

You can pass in the average of the quad’s position, which would return the middle of the quad.
x2-x1, y2-y1

Best regards,
Tyler

Hi Tyler,

Thank you so much for your assistance. With your help, we’ve successfully resolved the issue. If there’s nothing else, we can go ahead and close this ticket. Appreciate your support!

Thanks.