Skip to content
ComPDF
DemoSampleAPI ReferenceFAQ
New Release

Open-Source PDF SDK & AI Document Processing

Get the full self-hosted SDK and AI document processing on GitHub. One-click deploy to quickly build your document workflows.

Guides

Annotation Properties

Use annotationsConfig.initAttribute to set default properties for each annotation type. These properties are automatically applied when creating new annotations.

Note Annotation

json
{
  "annotationsConfig": {
    "initAttribute": {
      "note": {
        "color": "#1460F3",
        "alpha": 255
      }
    }
  }
}
FieldDescription
colorIcon color (hex)
alphaOpacity (0-255)

Markup Annotations

Includes highlight, underline, squiggly, and strikeout, which share the same property structure:

json
{
  "annotationsConfig": {
    "initAttribute": {
      "highlight": {
        "color": "#1460F3",
        "alpha": 77
      },
      "underline": {
        "color": "#1460F3",
        "alpha": 77
      },
      "squiggly": {
        "color": "#1460F3",
        "alpha": 77
      },
      "strikeout": {
        "color": "#1460F3",
        "alpha": 77
      }
    }
  }
}
FieldDescription
colorMarkup color
alphaOpacity (0-255)

Ink Annotation

json
{
  "annotationsConfig": {
    "initAttribute": {
      "ink": {
        "color": "#1460F3",
        "alpha": 100,
        "borderWidth": 10
      }
    }
  }
}
FieldDescription
colorPen color
alphaOpacity (0-255)
borderWidthPen line width

Shape Annotations

Square and Circle

json
{
  "annotationsConfig": {
    "initAttribute": {
      "square": {
        "fillColor": "#1460F3",
        "borderColor": "#000000",
        "colorAlpha": 128,
        "borderWidth": 2,
        "borderStyle": {
          "style": "solid",
          "dashGap": 0.0
        },
        "bordEffectType": "solid"
      },
      "circle": {
        "fillColor": "#1460F3",
        "borderColor": "#000000",
        "colorAlpha": 128,
        "borderWidth": 2,
        "borderStyle": {
          "style": "solid",
          "dashGap": 0.0
        },
        "bordEffectType": "solid"
      }
    }
  }
}
FieldDescription
fillColorFill color
borderColorBorder color
colorAlphaOpacity (0-255)
borderWidthBorder width
borderStyle.styleBorder style: "solid" or "dashed"
borderStyle.dashGapDash gap
bordEffectTypeBorder effect type: "solid" (normal) or "cloudy" (cloud)

Line

json
{
  "annotationsConfig": {
    "initAttribute": {
      "line": {
        "borderColor": "#1460F3",
        "borderAlpha": 100,
        "borderWidth": 5,
        "borderStyle": {
          "style": "solid",
          "dashGap": 0.0
        }
      }
    }
  }
}

Arrow

json
{
  "annotationsConfig": {
    "initAttribute": {
      "arrow": {
        "borderColor": "#1460F3",
        "borderAlpha": 100,
        "borderWidth": 5,
        "borderStyle": {
          "style": "solid",
          "dashGap": 0.0
        },
        "startLineType": "none",
        "tailLineType": "openArrow"
      }
    }
  }
}
FieldDescription
startLineTypeStart endpoint style
tailLineTypeEnd endpoint style

Endpoint style values: none, openArrow, closedArrow, square, circle, diamond, butt, ropenArrow, rclosedArrow, slash.

FreeText Annotation

json
{
  "annotationsConfig": {
    "initAttribute": {
      "freeText": {
        "fontColor": "#000000",
        "fontColorAlpha": 255,
        "fontSize": 30,
        "alignment": "left",
        "familyName": "Helvetica",
        "styleName": "Regular"
      }
    }
  }
}
FieldDescription
fontColorFont color
fontColorAlphaFont opacity (0-255)
fontSizeFont size
alignmentAlignment: "left", "center", "right"
familyNameFont family name (see Font Management)
styleNameFont style, e.g. "Regular", "Bold", "Italic"

Property Editor Fragments

Each annotation type has a corresponding property editor Fragment for editing annotation styles in the UI:

Annotation TypeFragment Class
MarkupCMarkupStyleFragment
NoteCNoteStyleFragment
InkCInkStyleFragment
FreeTextCFreeTextStyleFragment
ShapeCShapeStyleFragment
StampCStampStyleFragment
SignatureCSignatureStyleFragment
ImageCImageStyleFragment

When using source code integration, you can extend or modify these Fragments to customize the property panel UI.