CPDFImageAnnotation.fromAsset constructor
CPDFImageAnnotation.fromAsset({})
Creates an image annotation from a Flutter asset path.
Use this factory when the image is bundled with the application and
declared in pubspec.yaml.
Example:
final annotation = CPDFImageAnnotation.fromAsset(
page: 0,
rect: const CPDFRectF(
left: 40,
top: 80,
right: 200,
bottom: 220,
),
assetPath: 'assets/images/stamp.png',
);
Implementation
factory CPDFImageAnnotation.fromAsset({
String? title,
String? content,
DateTime? createDate,
required int page,
String uuid = '',
required CPDFRectF rect,
required String assetPath,
}) {
return CPDFImageAnnotation(
title: title ?? '',
content: content ?? '',
createDate: createDate,
page: page,
uuid: uuid,
rect: rect,
imageData: CPDFImageData.fromAsset(assetPath),
);
}