Problems creating multiple Annotations programmatically on mobile

Skip to first unread message


Jul 20, 2017, 5:20:57 AM7/20/17

we implemented a full page search feature in our WebViewer custom config.
It finds a search word in the full text of the page and gets the quads of these occurances.
After that it creates an annotation for every occurance and uses the TextHighlightCreateTool to draw them onto the page.

This works extremely well on the desktop version of the WebViewer but does not draw every annotation when doing the same on mobile.

As the culprit I have identified the use of the Underscore JS function "throttle" which wraps every call to the select Function of any TextTool on mobile.
This results in only drawing an annotation every 50 ms, every call inbetween is thrown away and no annotation is drawn.

The throttling occurs in MobileReaderControl.js line 196-199.

Is there a way to call the original select function of the TextTool directly without the throttling?

Thanks in advance

Justin Jung

Jul 20, 2017, 7:02:31 PM7/20/17
to PDFTron WebViewer on behalf of sbi
You can find the code below from MobileReaderControl.js and delete it:

var throttledSelect = _.throttle(, 50); = function() {
    throttledSelect.apply(this, arguments);

Justin Jung
Software Developer
PDFTron Systems Inc.


Jul 21, 2017, 3:36:44 AM7/21/17
to PDFTron WebViewer
Thanks for the tipp.

I don't really see it as a viable option to alter the WebViewer Code like this as it pretty much destroys the upgradeability (we already have some "hacks" in there as no real solution was provided).
A startup option to disable mobile throttling would be perfect.

Justin Jung

Jul 21, 2017, 6:42:06 PM7/21/17
to PDFTron WebViewer on behalf of sbi
After some more thought, we realized you can actually add the following to config.js:

var originalTextSelect =;

$(document).on('viewerLoaded', function() { = originalTextSelect;
Reply all
Reply to author
0 new messages