image method

  1. @override
Future<bool> image(
  1. Uint8List bytes, {
  2. int threshold = 150,
})
override

Implementation

@override
Future<bool> image(Uint8List bytes, {int threshold = 150}) async {
  if (this._selectedPrinter == null) {
    throw new Exception(
        "No printer available, please connect before sending.");
  }
  final commands = PrintCommands();
  commands.appendBitmapByte(
      byteData: bytes,
      width: this._width,
      diffusion: true,
      bothScale: true,
      alignment: StarAlignmentPosition.Center);
  commands.appendCutPaper(StarCutPaperAction.PartialCutWithFeed);
  final result = await StarPrnt.sendCommands(
      portName: this._selectedPrinter!,
      emulation: this._emulation,
      printCommands: commands);
  return result.isSuccess;
}