buildImage method
Implementation
@override
PdfImage buildImage(Context context, {int? width, int? height}) {
// Resampling at or above the pixel width could only upscale: keep the
// original pixels (see ImageProvider.resolve).
if (width == null || width >= _image.width) {
return PdfImage.fromImage(context.document, image: _image);
}
final resized = im.copyResize(_image, width: width);
return PdfImage.fromImage(context.document, image: resized);
}