CPDFWatermark.fromJson constructor
CPDFWatermark.fromJson(
- Map<String, dynamic> json
)
Implementation
factory CPDFWatermark.fromJson(Map<String, dynamic> json) {
return CPDFWatermark(
index: _asInt(json['index'], -1),
type: _watermarkTypeFromString(json['type']),
textContent: _asString(json['text_content'], ''),
imagePath: _asString(json['image_path'], ''),
isImageExported: _asBool(json['is_image_exported'], false),
textColor: _asColor(json['text_color']) ?? Colors.black,
fontSize: _asDouble(json['font_size'], 24).round(),
scale: _asDouble(json['scale'], 1.0),
rotation: _asDouble(json['rotation'], 45.0),
opacity: _asDouble(json['opacity'], 1.0),
verticalAlignment: _verticalAlignmentFromString(
json['vertical_alignment'],
),
horizontalAlignment: _horizontalAlignmentFromString(
json['horizontal_alignment'],
),
verticalOffset: _asDouble(json['vertical_offset'], 0.0),
horizontalOffset: _asDouble(json['horizontal_offset'], 0.0),
pages: _pagesFromString(_asString(json['pages'], '')),
isFront: _asBool(json['is_front'], true),
isTilePage: _asBool(json['is_tile_page'], false),
horizontalSpacing: _asDouble(json['horizontal_spacing'], 0.0),
verticalSpacing: _asDouble(json['vertical_spacing'], 0.0),
);
}