Determine what row (or Y value) of a searchText resut

Which product are you using?
PDFJs Express Pluss

PDF.js Express Version
8.7

Detailed description of issue
I’d like to be able to determine what row a string I was searching for with searchText was found in. I do get the Page Number and Quads from the result, but am not sure how translate the quads to a row (if that’s even a thing).

Expected behaviour
{Provide a screenshot or description of the expected behaviour}

Does your issue happen with every document, or just one?
{Answer here}

Link to document
{Provide a link to the document in question if possible}

Code snippet
{Provide a relevant code snippet}

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:

Guides:APIs:Forums:

Share how you are using PDF.js Express in your organization you could win a $500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free. Learn more here

Hi there,

While it isn’t possible to obtain a row from a quad, what you can do is create a bounding rectangle to represent the row of the selected word.

i.e.

const row = new Rect({x1: 0, y1: textQuad.y1, x2: pageWdith, y2: textQuad.y2})

Where textQuad is the quad of the selected text.

Hopefully this is helpful,

Best Regards,
Zach Serviss
Web Development Support Engineer
PDFTron Systems, Inc.


Share how you are using PDF.js Express in your organization you could win a $500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free. Learn more here