Want to get the toolname

Hi,
I want to get toolname on tool click of Toolheader.
For example When I click on Annotation tool-Group,and further click on Tools like “Highlight” or “Note”,
I should get its name. So that I can use that name with other Api calls.
Please help me out with toolname on tool click.

Hi there,

Thank you for contacting pdf.js express forums,

Here is our general guide on customizing toolbar in the viewer:

To get the specific toolnames, you can see them in the API docs here:
https://pdfjs.express/api/Core.Tools.html#.ToolNames

If you need the tool that you are currently on, you can use the following API:
UI: instance.UI.getToolMode().name
or
Core: instance.Core.documentViewer.getToolMode().name

Best regards,
Kevin Kim

I am able to get the tool name.
Thank You.
But, I am not able to get the code to get click event for tools(on the tool-Header).
I want to access the tool name as and when I click on the tool.
So, provide me the integrated code where I can have tool name on clicking the tool.
Thank You.

Hi there,

We do not have an event for when a tool is clicked, but we do have an event when the tool bar group changes:
https://pdfjs.express/api/UI.html#event:toolbarGroupChanged

If you would like a specific event for when the tool is selected, you can follow the advanced UI customization here: Advanced Customization with PDF.js Express Viewer | Documentation

Best regards,
Kevin Kim