Resource Base
Table of contents

DrawingStyle

The DrawingStyle interface defines a customizable set of style properties that can be applied to a DrawingItem.

interface DrawingStyle {
  fillStyle?: string;
  fontFamily?: string;
  fontSize?: number;
  readonly id?: number;
  lineWidth?: number;
  paintMode?: string;
  strokeStyle?: string;
}

fillStyle

The fill color and opacity in rgba format. If not specified, the default is “rgba(245, 236, 73, 0.5)”.

fontFamily

The font family for text elements. If not specified, the default is “consolas”.

fontSize

The font size for text elements. If not specified, the default is 40.

id

ID for the drawing style.

NOTE: The id property is immutable and is exclusively assigned at the creation of a new drawing style.

lineWidth

The width of lines. If not specified, the default is 2.

paintMode

The mode of painting (e.g., “fill”, “stroke” or “strokeAndFill”). If not specified, the default is “stroke”.

strokeStyle

The stroke color and opacity in rgba format. If not specified, the default is “rgba(245, 236, 73, 1)”.

Built-in DrawingStyles

The SDK comes with 8 default Drawing styles. Their style definitions are listed below

// DrawingStyle 1 (STYLE_BLUE_STROKE)
// Used by Dynamsoft Document Normalizer for DrawingItems in "default" state.
{
  "id": 1,
  "lineWidth": 4,
  "fillStyle": "rgba(73, 173, 245, 0.3)",
  "strokeStyle": "rgba(73, 173, 245, 1)",
  "paintMode": "stroke",
  "fontFamily": "consolas",
  "fontSize": 40
}
// DrawingStyle 2 (STYLE_GREEN_STROKE_FILL)
// Used by Dynamsoft Label Recognizer for DrawingItems in "default" state.
{
  "id": 2,
  "lineWidth": 2,
  "fillStyle": "rgba(73, 245, 73, 0.3)",
  "strokeStyle": "rgba(73, 245, 73, 0.9)",
  "paintMode": "strokeAndFill",
  "fontFamily": "consolas",
  "fontSize": 40
}
// DrawingStyle 3 (STYLE_ORANGE_STROKE_FILL)
// Used by Dynamsoft Barcode Reader for DrawingItems in "default" state.
{
  "id": 3,
  "lineWidth": 2,
  "fillStyle": "rgba(254, 180, 32, 0.3)",
  "strokeStyle": "rgba(254, 180, 32, 0.9)",
  "paintMode": "strokeAndFill",
  "fontFamily": "consolas",
  "fontSize": 40
}
// DrawingStyle 4 (STYLE_YELLOW_STROKE)
// Used by custom DrawingLayers for DrawingItems in "default" state.
{
  "id": 4,
  "lineWidth": 2,
  "fillStyle": "rgba(245, 236, 73, 0.3)",
  "strokeStyle": "rgba(245, 236, 73, 1)",
  "paintMode": "stroke",
  "fontFamily": "consolas",
  "fontSize": 40
}
// DrawingStyle 5 (STYLE_BLUE_STROKE_FILL)
// Used by Dynamsoft Document Normalizer for DrawingItems in "selected" state.
{
  "id": 5,
  "lineWidth": 4,
  "fillStyle": "rgba(73, 173, 245, 0.3)",
  "strokeStyle": "rgba(73, 173, 245, 1)",
  "paintMode": "strokeAndFill",
  "fontFamily": "consolas",
  "fontSize": 40
}
// DrawingStyle 6 (STYLE_GREEN_STROKE_FILL)
{
  "id": 6,
  "lineWidth": 2,
  "fillStyle": "rgba(73, 245, 73, 0.3)",
  "strokeStyle": "rgba(73, 245, 73, 0.9)",
  "paintMode": "strokeAndFill",
  "fontFamily": "consolas",
  "fontSize": 40
}
// DrawingStyle 7
// Used by Dynamsoft Barcode Reader for DrawingItems in "selected" state.
{
  "id": 7,
  "lineWidth": 2,
  "fillStyle": "rgba(254, 180, 32, 0.3)",
  "strokeStyle": "rgba(254, 180, 32, 1)",
  "paintMode": "strokeAndFill",
  "fontFamily": "consolas",
  "fontSize": 40
}
// DrawingStyle 8 (STYLE_YELLOW_STROKE_FILL)
// Used by custom DrawingLayers for DrawingItems in "selected" state.
{
  "id": 8,
  "lineWidth": 2,
  "fillStyle": "rgba(245, 236, 73, 0.3)",
  "strokeStyle": "rgba(245, 236, 73, 1)",
  "paintMode": "strokeAndFill",
  "fontFamily": "consolas",
  "fontSize": 40
}

This page is compatible for:

Version 1.0

Is this page helpful?

YesYes NoNo

latest version

  • Latest version(4.0.2)
  • Version 4.x
    • Version 4.0.1
    • Version 4.0.0
  • Version 3.x
    • Version 3.3.10
    • Version 3.3.9
    • Version 3.3.8
    • Version 3.3.7
    • Version 3.3.6
    • Version 3.3.5
    • Version 3.3.4
    • Version 3.3.3
    • Version 3.3.2
    • Version 3.3.1
    • Version 3.3.0
    • Version 3.2.0
    • Version 3.1.0
    • Version 3.0.1
    • Version 3.0.0
  • Version 2.x
    • Version 2.3.5
    • Version 2.3.2
    • Version 2.3.1
    • Version 2.3.0
    • Version 2.1.4
    • Version 2.1.3
    • Version 2.1.0
    • Version 2.0.0
Change +