Esc pos printer - POS (thermal, receipt) printing for Flutter & Dart

Overview

esc_pos_printer

Pub Version

The library allows to print 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 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 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();
}

You can find more examples here: esc_pos_utils.

Print a Receipt

import 'package:esc_pos_printer/esc_pos_printer.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

test receipt

test receipt

Comments
  • when I print my invoice image, the result of printer just take only half of paper width

    when I print my invoice image, the result of printer just take only half of paper width

    I used your package to print, almost everything works fine but one thing that I can't complete which is: when I print my invoice image, the result of printer just take only half of paper width, it didn't take the full width of paper.

    opened by kechankrisna 25
  • print test print blank

    print test print blank

    Stampante termica 80mm validatore di banconote 300mm/s, MUNBYN stampante per ricevute di banconote Stampante a matrice per biglietti/con registratore automatico di cassa con USB per POS/ESC

    this is a model

    opened by sante85 20
  • Unicode doesn't support

    Unicode doesn't support

    Printer.connect('192.168.1.87', port: 9100).then((printer) { printer.println( 'Regular:Welcome Cambodia'); printer.println('Special 1: ខ្ញុំស្រលាញ់កម្ពុជា ', styles: PosStyles(codeTable: PosCodeTable.pc850)); printer.println('Special 2: blåbærgrød', styles: PosStyles(codeTable: PosCodeTable.westEur));

    opened by ul-rotha 13
  • Speed of printing is slow for multiple ticket.row, ticket.text

    Speed of printing is slow for multiple ticket.row, ticket.text

    Hi,

    I have a question regarding the speed of printing. When there are a lot of ticket "rows" and "texts" split into multiple lines in the code, the printer throttles, stoping every "rows" and "text" command due to the nature of sending bytes through the network(?). Whereas, if it's sent by 1 large ticket text command, the printer prints at a speed by manufacturer print speed (for this case 200mm/s).

    Is this a limitation of ESC/POS commands by the network? or is there any way to improve this speed from this library?

    Thanks!

    opened by ileb325 9
  • Printing Reverse Text Always

    Printing Reverse Text Always

    Hi,

    After I update plugin to latest version, I faced this issue, even the example app results in the same, all text are printed as reverse text (black background and "white" font), tried in two diferent printers, and one of them, beyond that, the printer shutdown in middle of printing. (Maybe an issue with temperature, idk).

    Any one face this issue?

    opened by renenucci 9
  • Can't print special characters.

    Can't print special characters.

    So I've tried printing the example from the latin1 codec (since this plugin is already using it), which is: 'blåbærgrød'.

    So: printer.println('blåbærgrød', styles: PosStyles(codeTable: PosCodeTable.pc865)); Setting the code table doesn't seem to help, no matter which code table is chosen.

    It fails printing æ ø å, which is wierd since it's literally that example they show inside the latin1 codec.

    opened by larssn 9
  • Is the package still maintained??

    Is the package still maintained??

    So many issues are open till months and not one single response of the author ?

    Does someone has any informations or any alternative packages that we can use in production without those issues ?

    opened by emme1009 7
  • No Star Micronics Printer Compatibility

    No Star Micronics Printer Compatibility

    it seems that star micronics is a very dominant brand of printers in the POS world, however, when I attempt to print from one, it behaves poorly. It behaves similar to the way that my desktop home printer behaves.

    I get one line per page, with 0B00!. in front of the value. example: 0B00!.col30B00!.60B00!.col3 followed by about a foot of empty paper 0B00!.Text Size 200% followed by about a foot more blank paper

    I am guessing that there is just some encoding setting to change or something?

    opened by AirborneEagle 6
  • Printer not listing in bluetooth scanning

    Printer not listing in bluetooth scanning

    Tried with evolute prime ESC Bluetooth thermal printer. My printer not listing in scanned Bluetooth device list.

    Is this package support above mentioned printer ? Please provide some supporting printer list.

    opened by emsyneapps 6
  • printRow - PosColumn alignment issue

    printRow - PosColumn alignment issue

    I am using a BTP-R880NP Network Receipt Printer to print:

    Bag of Cherries......1....3.99....3.99 Drink................1...14.95...14.99

    Basically, I'm trying to align each column to their own alignment. (1) align: left, (2) align: center, (3) align: right, (4) align: right. But instead they are all aligning to what i set for the first column. They are all aligning to the left.

    My code:

                                              printer.printRow([
                                                PosColumn(
                                                  text: 'Bag of Cherries', // Drink
                                                  width: 6,
                                                  styles: PosStyles(
                                                    align: PosTextAlign.left,
                                                  ),
                                                ),
                                                PosColumn(
                                                  text: '1', // 1
                                                  width: 1,
                                                  styles: PosStyles(
                                                    align: PosTextAlign.center,
                                                  ),
                                                ),
                                                PosColumn(
                                                  text:
                                                      '3.99', // 14.95
                                                  width: 2,
                                                  styles: PosStyles(
                                                    align: PosTextAlign.right,
                                                  ),
                                                ),
                                                PosColumn(
                                                  text:
                                                      '3.99', //14.95
                                                  width: 3,
                                                  styles: PosStyles(
                                                    align: PosTextAlign.right,
                                                  ),
                                                ),
                                              ]);
    
    bug 
    opened by terence-truong 6
  • how to you have tested MUNBYN MU-ITPP047USEW-BK WiFi/Ethernet??

    how to you have tested MUNBYN MU-ITPP047USEW-BK WiFi/Ethernet??

    how to you have tested MUNBYN MU-ITPP047USEW-BK WiFi/Ethernet??

    Originally posted by @sante85 in https://github.com/andrey-ushakov/esc_pos_printer/issues/67#issuecomment-617247568

    opened by sante85 5
  • Star TSP100iii not working

    Star TSP100iii not working

    I am facing a problem while trying to print, it connects successfully but not printing.

    Please check it.🙏 @andrey-ushakov @ccfiel @en237 @WashingtonlGarcia

    opened by sumonwd 0
  • Poscolumn not working

    Poscolumn not working

    Hello, I have tested and tried everything but nothing works. I have attached a copy of my test receipt and self-test of my thermal printer, everything is working great but width and pos column not working for me, I have tried on 3 printers same issue with every printer,

    please check this Img https://pasteboard.co/lvm8ZnvJKPIm.jpg please help, Thanks, AmeeT

    opened by ameetaujla 0
  • Causes low memory issue while using in windows application

    Causes low memory issue while using in windows application

    After printing 100+ bills in the windows app it shows low memory alert and system hangs. While checking task manager, it is found that committed memory usage increases while printing and when it hits the maximum, system hangs. Is there any way to clear system's committed memory used while printing?

    opened by saranyags 0
  • Does it works on any printer?

    Does it works on any printer?

    I'm just wondering how this package works, using native languages like java you need to get the SDK of the printer and install drivers to connect the printer to the app.

    My question is: does this package doesn't need drivers/SDK installation?

    opened by A7mdlbanna 2
  • Arabic Text Bug

    Arabic Text Bug

    Hi, thanks for the plugin

    I'm trying to print Arabic text, but it's working. I tried to convert the Arabic text to an image (using the widget screenshot plugin), but it's not readable.

    You can tell a proper way to deal with this issue.

    opened by Ashish-Raturi 2
Owner
Andrey
Andrey
Flutter POS Printer - A library to discover printers, and send printer commands

Flutter POS Printer - A library to discover printers, and send printer commands

Nguyễn Đức Hiếu 2 Oct 5, 2022
Flutter pos - A mobile POS written in Flutter, suitable for small cafe/restaurant, fully offline

Simple-POS A mobile POS written in Flutter, suitable for small cafe/restaurant,

Muhammed Basil E 7 Nov 2, 2022
POS plugging to connect with each type of pos device.

flutter_pos_printer A new flutter plugin project. Getting Started This project is a starting point for a Flutter plug-in package, a specialized packag

Harshit sharma 3 Aug 25, 2022
Receipt parser application written in dart.

Receipt manager You can find pre-compiled releases on the Github release page or in the FDROID repository. All the needed info about how to use the re

null 132 Dec 29, 2022
A Flutter library allows to print receipts using a Bluetooth printer

esc_pos_bluetooth The library allows to print receipts using a Bluetooth printer. For WiFi/Ethernet printers, use esc_pos_printer library. TODO (PRs a

null 3 Dec 20, 2021
A flutter package that developers have pretty logs instead just printing everything like a newbie

A flutter package that developers have pretty logs instead just printing everything like a newbie. Features Makes it easy to log to console without us

null 2 Nov 28, 2021
A package for manipulating stack traces and printing them readably.

This library provides the ability to parse, inspect, and manipulate stack traces produced by the underlying Dart implementation. It also provides func

Dart 102 Nov 29, 2022
A demo version of POS project.

pos_simplified A demo version of POS project. Getting Started This project is a starting point for a Flutter application. A few resources to get you s

Mahdi Sarhangi 1 Dec 28, 2021
Mysql.dart - MySQL client for Dart written in Dart

Native MySQL client written in Dart for Dart See example directory for examples

null 48 Dec 29, 2022
Flutter Navigation - all types of navigation in flutter run main.tabBar.dart to see tabBar, and run main.dart to see the otheres

pop_up_bar A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if th

Michael Odumosu 0 Jan 1, 2022
Flutter Dart-Projesi - Meditation app developed using Flutter and Dart

Müzik Çalar Meditasyon Uygulaması Medi Flutter ve Dart ile programlanmış bir med

null 2 Jan 29, 2022
A Dart client for the NATS messaging system. Design to use with Dart and Flutter.

Dart-NATS A Dart client for the NATS messaging system. Design to use with Dart and flutter. Flutter Web Support by WebSocket client.connect(Uri.parse(

Chart Chongcharoen 32 Nov 18, 2022
GitHub Action that uses the Dart Package Analyzer to compute the Pub score of Dart/Flutter packages

Dart/Flutter package analyzer This action uses the pana (Package ANAlysis) package to compute the score that your Dart or Flutter package will have on

Axel Ogereau-Peltier 45 Dec 29, 2022
🎬 A movie catalog app for both Android & IOS ~ Flutter.io project in Dart | Dart, Bloc, Movies

Movie Catalog App ?? Browse through movies from the YIFY api Getting Started For help getting started with Flutter, view our online documentation. Tod

Jonas De Vrient 49 Nov 21, 2022
Flying Fish is full-stack Dart framework - a semi-opinionated framework for building applications exclusively using Dart and Flutter

Flying Fish is full-stack Dart framework - a semi-opinionated framework for building applications exclusively using Dart and Flutter.

Flutter Fish 3 Dec 27, 2022
This is a dart package that converts words to numbers. It can be used in Flutter and normal Dart programs

Wordstonumbers.dart Wordstonumbers.dart is a simple dart package that converts a string of simple worded numbers into digits (e.g one hundred -> 100).

Michael Essiet 3 Oct 17, 2022
I start to learn dart-flutter. And also this project was basics of Dart

learning_dart A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if

Natiq Haciyev 3 Dec 14, 2022
A Dart/Flutter package to perform network calls. It uses Isolates to perform network calls on Dart VM environments and WebWorkers on Web.

ArDriveHTTP ArDriveHTTP is a package to perform network calls for ArDrive Web. It uses Isolates to perform network calls on Dart VM environments and W

AR.IO 2 Dec 15, 2022