How do I add the save annotations button to the toolbar?

67 views
Skip to first unread message

Ryan - PDFNet Developer

unread,
Nov 17, 2017, 1:39:19 PM11/17/17
to PDFTron WebViewer
Question:

There is a button buried in the annotations side menu dropdown, which I would like to make a "copy" of and place in the toolbar.

Answer:

You can accomplish this with a few lines of code in a config.js file. First, make sure your WebViewer constructor loads a config file.

myWebViewer = new PDFTron.WebViewer({
     
...
     config
:'config.js',
     
...
 
}, viewerElement);

Your config.js file would then include the following.

var $button1 = $('<button type="button">Submit Annotations</button>');
$button1
.on('click', function() {
    readerControl
.saveAnnotations();
});
$
('#control').append($button1);

Attached is a standalone config.js file.
config.js.txt
Reply all
Reply to author
Forward
0 new messages