Setting the Default Tool Mode

178 views
Skip to first unread message

Matt Parizeau

unread,
Jul 30, 2013, 3:33:42 PM7/30/13
to pdfnet-w...@googlegroups.com
Q:

When the document loads, I want to make the text highlight as the default annotation tool.  How do I go about doing that?

A:

To set the tool mode to text highlight I would add an external config file with the following code:
(function() {

    $
(document).on('documentLoaded', function() {
        
var ToolModes = readerControl.docViewer.ToolModes;
        readerControl
.docViewer.SetToolMode(ToolModes.TextHighlightCreate);
    
});

})();
You could name the file something like config.js and then in the WebViewer constructor (new PDFTron.WebViewer({...) you would add to the options object the code: config: "config.js"

Matt Parizeau

unread,
Apr 29, 2015, 8:50:53 PM4/29/15
to pdfnet-w...@googlegroups.com
For WebViewer 2.0 you would use:

$(document).on('documentLoaded', function() {
    readerControl
.setToolMode(window.PDFTron.WebViewer.ToolMode.AnnotationCreateTextHighlight);
});
Reply all
Reply to author
Forward
0 new messages