Adding new buttons to the annotation edit popup

66 views
Skip to first unread message

Matt Parizeau

unread,
Nov 15, 2016, 6:35:44 PM11/15/16
to PDFTron WebViewer
Q:

Is it possible to add new buttons or HTML elements to the annotation edit popup that appears after selecting an annotation?

A:

Yes, here is some example code:

$(document).on('viewerLoaded', function() {
  var customButton = $('<button type="button" class="roundedCornerButton">Test Button</button>');
  customButton.on('click', function() {
    alert('Clicked custom button');
  });

  window.AnnotationEdit.buttons.push({
    element: customButton,
    isHidden: function() {
      return false;
    }
  });

  var otherElement = $('<select><option>Test1</option><option>Test2</option></select>');
  otherElement.css('font-size', '12px')
  window.AnnotationEdit.buttons.push({
    element: otherElement,
    isHidden: function() {
      return false;
    }
  });
});
Reply all
Reply to author
Forward
0 new messages