Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

esc_pos printing

the library allows printing receipts using an esc/pos thermal wifi/ethernet printer. for bluetooth printers, use esc_pos_bluetooth library.

it can be used in flutter or pure dart projects. for flutter projects, both android and ios are supported.

to scan for printers in your network, consider using ping_discover_network package. note that most of the esc/pos printers by default listen on port 9100.

todo (prs are welcomed!)

  • print qr codes using the gs ( k command (printing qr code from an image already supported)
  • pdf-417 barcodes using the gs ( k command
  • line spacing using the esc 3 <n> command

how to help

  • test your printer and add it in the table: wifi/network printer or bluetooth printer
  • test and report bugs
  • share your ideas about what could be improved (code optimization, new features…)
  • prs are welcomed!

tested printers

here are some printers tested with this library. please add the models you have tested to maintain and improve this library and help others to choose the right printer.

generate a ticket

simple ticket with styles:

ticket testticket() {
  final ticket ticket = ticket(papersize.mm80);

  ticket.text(
      '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');
  ticket.text('special 1: àà èè éé ûû üü çç ôô',
      styles: posstyles(codetable: poscodetable.westeur));
  ticket.text('special 2: blåbærgrød',
      styles: posstyles(codetable: poscodetable.westeur));

  ticket.text('bold text', styles: posstyles(bold: true));
  ticket.text('reverse text', styles: posstyles(reverse: true));
  ticket.text('underlined text',
      styles: posstyles(underline: true), linesafter: 1);
  ticket.text('align left', styles: posstyles(align: posalign.left));
  ticket.text('align center', styles: posstyles(align: posalign.center));
  ticket.text('align right',
      styles: posstyles(align: posalign.right), linesafter: 1);

  ticket.text('text size 200%',
      styles: posstyles(
        height: postextsize.size2,
        width: postextsize.size2,
      ));

  ticket.feed(2);
  ticket.cut();
  return ticket;
}

you can find more examples here: esc_pos_utils.

printing a ticket

import 'package:esc_pos_printer/esc_pos_printer.dart';

final printernetworkmanager printermanager = printernetworkmanager();
printermanager.selectprinter('192.168.0.123', port: 9100);
final posprintresult res = await printermanager.printticket(testticket());

print('print result: ${res.msg}');

for a complete example, check example/example.dart and example/discover_printers.

test print

receipt2

receipt


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Comments are closed.