NPM Package/docs/capabilities/styles/annotation-styles
Annotation Styles
Inspect and update styling properties of existing annotations by GUID using the SDK.
Use viewer.styles.getAnnotationProperties(...) and viewer.styles.setAnnotationProperties(...) to inspect and update the style of an existing annotation by GUID.
Annotation style commands are available after the viewer is mounted, Canvas is ready, and a document is open.
typescript
Overview
Listen for selection change events to capture annotation GUIDs:
typescript
Track Selected Annotation
Query the current active properties style configurations of a selected annotation:
getAnnotationProperties(...)sendsgetAnnotationPropertiesand waits forannotationPropertieswith matchingguidvalues. Avoid overlapping reads for identical GUID references.
typescript
Read Properties
Update properties using the target annotation GUID:
setAnnotationProperties(...)returnsvoid. Update calls run asynchronously as one-way commands.
typescript
Update Properties
Configuration properties structure schema model:
- strokeColor: Outlines color hex string.
- fillColor: Fill color hex string.
- textColor: Label labels typography color hex.
- lineWidth: Size rating (1 to 10).
- lineStyle: Layout shape style representation indices (0 solid, 1 dashed, 2 dotted).
- transparency: Transparency percentage scale (0 opaque to 100 transparent).
- locked: Lock option state representation boolean value.
- countType: Shape layout marker indices (0 circle, 1 square, 2 triangle, 3 diamond).
typescript
Property Structure Reference
Complete integration code setup for Vanilla HTML/JS environments:
Vanilla Example
Broker message mapping for annotation style properties:
viewer.styles.getAnnotationProperties(...)maps togetAnnotationProperties.viewer.styles.setAnnotationProperties(...)maps tosetAnnotationProperties.
