how are character index been calculated and highlight correctly

Skip to first unread message

Thomas Chan

Nov 28, 2016, 1:02:43 PM11/28/16
to PDFTron WebViewer
Hello guys, 

can you let me know how are characters index been calculated?  or if there's way to override it?
Basically we have our annotations saved, when we do highlight we load the annotations and have the startIndex and endIndex to do the highlight,
providing the same startIndex and endIndex to the getTextPosition method return a incorrect quads for the highlightTool, please see below picture

Text need to selected:

DESTRUCTION OF PREMISES: If the premises become totally or partially destroyed during the term of this Agreement so that RESIDENT'S use is seriously impaired, OWNER or RESIDENT may terminate this Agreement immediately upon three day written notice to the other.

I also try to do the textSearchInit by providing the first 20 characters and to see if I can use those quads to do the highlight, but it doesn't return any quads.
Do you guys have any suggestions on select the text position correctly?

Thank you

Matt Parizeau

Nov 29, 2016, 2:40:10 PM11/29/16
to PDFTron WebViewer
Hi Thomas,

Whatever is returned from the loadPageText function is the order of the text used for the getTextPosition function. You can refer to the text-position sample in the WebViewer download package for some sample code. Here is a link to that config file from the sample on our website

Matt Parizeau
Software Developer
PDFTron Systems Inc.
Reply all
Reply to author
0 new messages