Read text from the region by giving coordinates

Skip to first unread message

ar m

Feb 24, 2021, 12:27:36 AM2/24/21
to PDFTron WebViewer

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();

Wanbo Li

Feb 25, 2021, 11:08:04 AM2/25/21
to PDFTron WebViewer

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.

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.

Reply all
Reply to author
Message has been deleted
0 new messages