imageFromBytes method
Print image from bytes
Implementation
PrintBuilder imageFromBytes(
Uint8List imageBytes, {
AlignPos align = AlignPos.center,
int? maxWidth,
}) {
// Set alignment
switch (align) {
case AlignPos.left:
_bytes.addAll(ESCPOSCommands.alignLeft);
break;
case AlignPos.center:
_bytes.addAll(ESCPOSCommands.alignCenter);
break;
case AlignPos.right:
_bytes.addAll(ESCPOSCommands.alignRight);
break;
}
// Process image and add to bytes
final processedImage = ImageProcessor.processImageForPrinting(
imageBytes,
paperSize: paperSize,
maxWidth: maxWidth,
);
_bytes.addAll(processedImage);
// Reset alignment
_bytes.addAll(ESCPOSCommands.alignLeft);
return this;
}