DocuVieware Reference Guide
AddAnnotationsActionButton
Reference Guides > JavaScript API > Actions > Interface > AddAnnotationsActionButton
 AddAnnotationsActionButton

This function allows you to add a custom item to the selected annotation action buttons list.

AddAnnotationsActionButton: function (docuViewareID, caption, icon, callback)

Parameters

docuViewareID
The identifier for the DocuVieware™ instance you want to add an annotation action custom button to.
caption
A string that represent the text that will be displayed as tooltip.
icon
A string that contains the SVG markup for the icon that will be displayed.
callback
A function that will be executed when the user clicks on the button.
It provides an argument with the following prototype: { id } which is the selected annotation identifier.

Example of usage

This code adds a star button to the annotation action button list that displays the selected annotation identifier in the console.

DocuViewareAPI.AddAnnotationsActionButton("DocuVieware1",
      "Test",
      "<svg width='100%' height='100%' viewBox='0 0 16 16'><path d='M16 6.204l-5.528-0.803-2.472-5.009-2.472 5.009-5.528 0.803 4 3.899-0.944 5.505 4.944-2.599 4.944 2.599-0.944-5.505 4-3.899z'></path></svg>",
      function (annot) { console.log(annot.id) });

Return Value

1 if error, 0 if success.