buildImage method
Implementation
@override
PdfImage buildImage(Context context, {int? width, int? height}) {
if (width == null) {
return PdfImage.file(context.document, bytes: bytes);
}
final image = im.decodeImage(bytes);
if (image == null) {
throw Exception('Unable decode the image');
}
final resized = im.copyResize(image, width: width);
return PdfImage.fromImage(context.document, image: resized);
}