Hide new annotation tool buttons

143 views
Skip to first unread message

Chris Hine

unread,
Oct 7, 2015, 5:50:34 PM10/7/15
to PDFTron WebViewer
Hi,

I'm updating our WebViewer to 2.0.0 and have noticed the new annotation tool buttons next to the pan and text selection ones. We'd like to remove those to have the bar contain just what it did before.

I see that I can hide all those tools via our config file like so:
$('#toolList').hide();

However, wanting to keep pan and text select causes me to need to be more selective; when I try something like this:
$('#toolList').children().each(function(i, ele) {
   
var tool = $(ele).attr('data-toolmode');
   
if (tool !== 'Pan' && tool !== 'TextSelect') {
        $
(ele).hide();
   
}
});

I can see that they are missing while the document is loading but they reappear once it has loaded.

Is there some other way I'd be better to go about this?

Thanks,
Chris

Anatoly Kudrevatukh

unread,
Oct 7, 2015, 5:52:28 PM10/7/15
to PDFTron WebViewer
Hello Chris,

Please see the following post:

Cheers.

Chris Hine

unread,
Oct 8, 2015, 3:51:49 PM10/8/15
to PDFTron WebViewer
Hi Anatoly,

The part about prevention of an undesired tool is interesting, but I'm afraid that post doesn't seem to have helped.

If I place this in my config.js
debugger;
$
('[data-toolmode="AnnotationCreateFreeText"]').hide();


I can observe that it runs before any of the PDFTron UI has rendered. Then, after the UI and the tool bar has rendered and loading of the XOD has begun, I can see the part of the toolbar in question has the Pan and Text Selection tools only:


And once the document has loaded the rest of the annotation tools are present:




I'd like to remove those other tools.

Thanks,
Chris

Anatoly Kudrevatukh

unread,
Oct 8, 2015, 4:18:43 PM10/8/15
to PDFTron WebViewer
If you place the call to hide tools in $(document).on('documentLoaded' handler then it should work as expected.
Reply all
Reply to author
Forward
0 new messages