PrinterTextParserImg constructor

PrinterTextParserImg(
  1. PrinterTextParserColumn printerTextParserColumn,
  2. String textAlign,
  3. HashMap<String, String> imageAttributes, {
  4. String? hexadecimalString,
  5. Uint8List? bytes,
})

Implementation

PrinterTextParserImg(
  PrinterTextParserColumn printerTextParserColumn,
  String textAlign,
  HashMap<String, String> imageAttributes, {
  String? hexadecimalString,
  Uint8List? bytes,
}) {
  Uint8List image = Uint8List(0);

  if (hexadecimalString != null) {
    image = PrinterTextParserImg.hexadecimalStringToBytes(hexadecimalString);
  }

  if (bytes != null) {
    image = bytes;
  }

  _align = EscPosPrinterCommands.textAlignLeft;
  switch (textAlign) {
    case PrinterTextParser.tagsAlignCenter:
      _align = EscPosPrinterCommands.textAlignCenter;
      break;
    case PrinterTextParser.tagsAlignRight:
      _align = EscPosPrinterCommands.textAlignRight;
      break;
  }
  _image = image;
}