esc_pos_printer_v2 0.0.1 copy "esc_pos_printer_v2: ^0.0.1" to clipboard
esc_pos_printer_v2: ^0.0.1 copied to clipboard

discontinued

The library allows to print receipts using an ESC/POS thermal WiFi printer(v2).

esc_pos_printer_v2 #

Pub Version

It can be used in Flutter or pure Dart projects. For Flutter projects, both Android and iOS are supported.

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 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 Receipt #

Simple Receipt with Styles: #

void testReceipt(NetworkPrinter printer) {
  printer.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');
  printer.text('Special 1: àÀ èÈ éÉ ûÛ üÜ çÇ ôÔ',
      styles: PosStyles(codeTable: 'CP1252'));
  printer.text('Special 2: blåbærgrød',
      styles: PosStyles(codeTable: 'CP1252'));

  printer.text('Bold text', styles: PosStyles(bold: true));
  printer.text('Reverse text', styles: PosStyles(reverse: true));
  printer.text('Underlined text',
      styles: PosStyles(underline: true), linesAfter: 1);
  printer.text('Align left', styles: PosStyles(align: PosAlign.left));
  printer.text('Align center', styles: PosStyles(align: PosAlign.center));
  printer.text('Align right',
      styles: PosStyles(align: PosAlign.right), linesAfter: 1);

  printer.text('Text size 200%',
      styles: PosStyles(
        height: PosTextSize.size2,
        width: PosTextSize.size2,
      ));

  printer.feed(2);
  printer.cut();
}
import 'package:esc_pos_printer_v2/esc_pos_printer_v2.dart';

const PaperSize paper = PaperSize.mm80;
final profile = await CapabilityProfile.load();
final printer = NetworkPrinter(paper, profile);

final PosPrintResult res = await printer.connect('192.168.0.123', port: 9100);

if (res == PosPrintResult.success) {
  testReceipt(printer);
  printer.disconnect();
}

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

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

Test Print #

1
likes
130
points
27
downloads

Publisher

verified publisherpixelplatforms.com

Weekly Downloads

The library allows to print receipts using an ESC/POS thermal WiFi printer(v2).

Homepage

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

charset_converter, esc_pos_utils_v2, flutter, image

More

Packages that depend on esc_pos_printer_v2