Set toolMode to sticky note in angular

Product: webViewer

Product Version: 8.6.0

I’m customizing the header and I’m trying to toggle the sticky note Tool in angular with my own action and I can’t get it to work.

I’m using : instance.UI.setToolMode(‘STICKY’);

the code : instance.UI.setHeaderItems(header => {
header.push({
type: ‘actionButton’,
img: ‘assets/comment.svg’,
onClick: () => {
instance.UI.setToolMode(‘STICKY’);
}
});
});

I found this tool name here : PDFTron WebViewer Namespace: Tools

is it the right tool name ?
If so what can I try to solve this ?

Hi Rodolphe,

So that list of tool names is the correct variable but it must be accessed through Core.Tools.ToolNames.

i.e.
instance.UI.setToolMode(instance.Core.Tools.ToolNames.STICKY);

This will return the correct tool to create.

Best Regards,
Zach Serviss
Web Development Support Engineer
PDFTron Systems, Inc.

Hi,

thank you, it helped me to make it work.

my code :
const { documentViewer} = instance.Core;
stickyTool = documentViewer.getTool(instance.Core.Tools.ToolNames.STICKY);
documentViewer.setToolMode(this.stickyTool);