CPDFImageAnnotation.fromBase64 constructor
CPDFImageAnnotation.fromBase64({})
Creates an image annotation from a raw Base64 string.
Use this factory when the image bytes are already encoded as Base64 and can be embedded directly into the annotation payload.
Example:
final annotation = CPDFImageAnnotation.fromBase64(
page: 0,
rect: const CPDFRectF(
left: 80,
top: 120,
right: 220,
bottom: 260,
),
base64: 'iVBORw0KGgoAAAANSUhEUgAAAAUA...',
);
Implementation
factory CPDFImageAnnotation.fromBase64({
String? title,
String? content,
DateTime? createDate,
required int page,
String uuid = '',
required CPDFRectF rect,
required String base64,
}) {
return CPDFImageAnnotation(
title: title ?? '',
content: content ?? '',
createDate: createDate,
page: page,
uuid: uuid,
rect: rect,
imageData: CPDFImageData.fromBase64(base64),
);
}