How do i change default value of Rectangle > Storke > Style as Cloudy

How can i change default value of Rectangle > Storke > Style as Cloudy.

Based our requirement we need to set default value as Cloudy in Rectangle > Storke > Style.

Please provide code or documentation for that so we can set in our side.

Hey there! Thanks for trying out Express.

You can use this code to set the default style for a tool:

  const { docViewer, Tools } = instance;

  docViewer.getTool(Tools.ToolNames.RECTANGLE).setStyles({
    Style: 'cloudy'
  })

Let me know if you have any other questions!

Thanks,
Logan

1 Like

Thanks,
This is work for me but i want to set in all 4 tabs. Check attachment. Please provide code or documentation for that.

const rectangleTools = [
    Tools.ToolNames.RECTANGLE,
    Tools.ToolNames.RECTANGLE2,
    Tools.ToolNames.RECTANGLE3,
    Tools.ToolNames.RECTANGLE4
]

rectangleTools.forEach(toolName => {
  docViewer.getTool(toolName).setStyles({
    Style: 'cloudy'
  })
})

You provided solution for all for RECTANGLE tools but that not found in ToolNames. Only exist for 1 RECTANGLE. Other tools are available.
Is there other solution for that?
Check attachment image.

Hey there,

Please make sure you’re using the latest version. All 4 rectangle tools should be listed there

image

If you still have issues please let me know!