toJson method
Implementation
Map<String, dynamic> toJson() {
switch (annotationType) {
case CPDFAnnotationType.note:
case CPDFAnnotationType.highlight:
case CPDFAnnotationType.underline:
case CPDFAnnotationType.squiggly:
case CPDFAnnotationType.strikeout:
return {'color': color?.toHex(), 'alpha': alpha};
case CPDFAnnotationType.ink:
return {
'color': color?.toHex(),
'alpha': alpha,
'borderWidth': borderWidth
};
case CPDFAnnotationType.square:
case CPDFAnnotationType.circle:
return {
'fillColor': fillColor?.toHex(),
'borderColor': borderColor?.toHex(),
'colorAlpha': colorAlpha,
'borderWidth': borderWidth,
'borderStyle': borderStyle?.toJson(),
};
case CPDFAnnotationType.line:
case CPDFAnnotationType.arrow:
return {
'borderColor': borderColor?.toHex(),
'borderAlpha': borderAlpha,
'borderWidth': borderWidth,
'borderStyle': borderStyle?.toJson(),
'startLineType': startLineType?.name,
'tailLineType': tailLineType?.name
};
case CPDFAnnotationType.freetext:
return {
'fontColor': fontColor?.toHex(),
'fontColorAlpha': fontColorAlpha,
'fontSize': fontSize,
'isBold': isBold,
'isItalic': isItalic,
'alignment': alignment?.name,
'typeface': typeface?.getFontName(),
};
default:
return {};
}
}