Flutter printer and cashier

Library use for connecting to a printer

import 'package:esc_pos_printer/esc_pos_printer.dart';

Printer.connect('192.168.0.123', port: 9100).then((printer) {
    printer.println('Regular: aA bB cC dD eE fF gG hH iI jJ kK lL mM nN oO pP qQ rR sS tT uU vV wW xX yY zZ');
    printer.println('Special 1: àÀ èÈ éÉ ûÛ üÜ çÇ ôÔ',
        styles: PosStyles(codeTable: PosCodeTable.westEur));
    printer.println('Special 2: blåbærgrød',
        styles: PosStyles(codeTable: PosCodeTable.westEur));

    printer.println('Bold text', styles: PosStyles(bold: true));
    printer.println('Reverse text', styles: PosStyles(reverse: true));
    printer.println('Underlined text',
        styles: PosStyles(underline: true), linesAfter: 1);

    printer.println('Align left', styles: PosStyles(align: PosTextAlign.left));
    printer.println('Align center',
        styles: PosStyles(align: PosTextAlign.center));
    printer.println('Align right',
        styles: PosStyles(align: PosTextAlign.right), linesAfter: 1);
    
    printer.println('Text size 200%',
        styles: PosStyles(
          height: PosTextSize.size2,
          width: PosTextSize.size2,
        ));

    printer.cut();
    printer.disconnect();
  });

To open cashier

https://www.beaglehardware.com/howtoprogramcashdrawer.html

  • Connect cashier to the printer  via a phone cable
  • Cable datasheet
  • Controlling the cash drawer
  • ESC POS Control
The Epson ESC POS Drawer Kick cash drawer command enables the control of either 1 or 2 Cash drawers

ESC p m t1 t2

Where

ESC p is the drawer kick command

m is the DK connector pin to output control signals ( 0 for Pin2/drawer1  or 1 for Pin5/drawer2 )

t1 is the ON time of the drawer kick signal. The ON time is 2 mS x t1 value.

t2 is the OFF time of the drawer kick signal ( time before the next ON signal can be received ) The OFF time is 2 mS x t2 value.
  • Programming Examples
ESC p m t1 t2
  • Decimal Example
MSComm1.Output = ESC + p + 0 + 25 + 250

MSComm1.Output = Chr(27) + Chr(112) + Chr(0) + Chr(25) + Chr(250)

Kick drawer 1 with the following 50mS on / 500mS off pulse
  • Connect to the printer via a library (esc_pos_printer) and send raw command (remember done hard lock cashier, unless it can not be opened)
// nhancv: Flutter kick drawer 1 with the following 50mS on / 500mS off pulse
printer.sendRaw([27, 112, 0, 25, 250]);

Leave a Reply

Your email address will not be published.Required fields are marked *