How to integrate tool button behavior with a custom UI Button outside the viewer screen

PDF.js Express Version

Detailed description of issue
Can we integrate rectangle tool on the click of a button outside viewer. What will be the api to do that? Need a side toolbar as shown in the image.

Expected behaviour


Link to document
{Provide a link to the document in question if possible}

Code snippet
{Provide a relevant code snippet}


Yes this is definitely possible.

You can use the setToolMode API to set the tool to rectangle tool (or any tool)

  const { docViewer} = instance;