Read text from the region by giving coordinates

Hi,

I am trying to read the text from the region by giving the coordinates. but its not able to read the right text from that region. It returns the wrong text.

Any help would be appreciated.

My Code:

const txt = await PDFNet.TextExtractor.create();
const rect = await PDFNet.Rect.init(99.98378847999993, 1555.54, 180, 1574.7627664);

await txt.begin(firstPage , rect); // Read the page.

//Extract words one by one.

let line = await txt.getFirstLine();

for (; (await line.isValid()); line = (await line.getNextLine()))
{
for (let word = await line.getFirstWord(); (await word.isValid()); word = (await word.getNextWord()))
{
const text = await word.getString();

console.log(text);
}
}

Hi,

May I know which version of WebViewer are you using? And may I also have the file you used for this? Thanks.

Best Regards,
Wanbo Li
Software Developer
PDFTron Systems, Inc.
www.pdftron.com

CONFIDENTIALITY NOTICE: This message (and any attachment to it) is intended only for the use of the individual or entity to which it is addressed in the header, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. Any reproduction, distribution, modification or use of the contents of this message (and any attachment to it) by any individual or entity other than the intended recipient is prohibited. If you have received this communication in error, please notify us immediately and delete the original.