tsplTextTest static method

List<int> tsplTextTest({
  1. double widthMm = 50,
  2. double heightMm = 30,
  3. double gapMm = 2,
  4. LabelMedia media = LabelMedia.gap,
  5. PrinterDpi dpi = PrinterDpi.dpi203,
})

Text and a box with printer fonts only -- no bitmap. If this prints but image labels don't, the printer is fine and the image job is the issue; if this doesn't print either, check the language / media / size.

Implementation

static List<int> tsplTextTest({
  double widthMm = 50,
  double heightMm = 30,
  double gapMm = 2,
  LabelMedia media = LabelMedia.gap,
  PrinterDpi dpi = PrinterDpi.dpi203,
}) {
  final w = dpi.mmToDots(widthMm), h = dpi.mmToDots(heightMm);
  return latin1.encode(
    [
      'SIZE ${LabelJob._mm(widthMm)} mm,${LabelJob._mm(heightMm)} mm',
      LabelJob._mediaLine(media, gapMm),
      'DIRECTION 1',
      'CLS',
      'BOX 8,8,${w - 8},${h - 8},3',
      'TEXT 24,24,"3",0,1,1,"TSPL TEXT TEST"',
      'TEXT 24,64,"2",0,1,1,"${LabelJob._mm(widthMm)}x${LabelJob._mm(heightMm)} mm ${dpi.value}dpi"',
      'PRINT 1,1',
      '',
    ].join('\r\n'),
  );
}