• Docs
  • Showcase
  • Community
  • DMCA
Friday, February 26, 2021
Flutter Website
No Result
View All Result
  • Login
  • Register
Flutter Website
  • Home
  • Categories
    • Flutter App
    • Flutter Examples
    • Flutter Github
    • Flutter News
    • Flutter PDF
    • Flutter Tips & Trick
    • Flutter Tutorial
    • Flutter UI
    • Flutter Video
    • Flutter VS
    • Flutter Wiki
    • Flutter With
  • Flutter
    • Flutter for Mobile
    • Flutter for Web
      • Widget Sample
    • Flutter for Desktop
    • Tools
      • Codemagic
      • Flutter Studio
      • Supernova
  • Showcase
  • Community
  • Advertisement
  • Hire Us
No Result
View All Result
Flutter Website
Home Flutter Awesome

ESC/POS (thermal, receipt) printing for Flutter & Dart

flutter by flutter
Reading Time: 2min read
961
Esc/pos (thermal, receipt) printing for flutter & dart
850
SHARES
1.2k
VIEWS
Share on FacebookShare on TwitterShare on LinkedinShare to Whatsapp

Table of Contents

  • esc_pos_printer
  • TODO (PRs are welcomed!)
  • How to Help
  • Tested Printers
  • Generate a Ticket
    • Simple Ticket with Styles:
  • Print a Ticket
  • Test Print
  • GitHub


esc_pos_printer

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 <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.

Print 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

Receipt

GitHub

Source by [author_name]

Tags: Flutter Awesome

Related Posts

A flutter plugin for integrating razorpay payment gateway
Flutter Awesome

A flutter plugin for integrating razorpay payment gateway

547
Clip your widgets with custom shapes provided
Flutter Awesome

Clip your widgets with custom shapes provided

626
News reader app to fetch articles from different news channels using flutter
Flutter Awesome

News Reader App to fetch Articles from different news channels using Flutter

634
Draw svg and android vectordrawable files on a flutter widget
Flutter Awesome

Draw SVG and Android VectorDrawable files on a Flutter Widget

751
A tidy utility to handle offline/online connectivity like a boss
Flutter Awesome

A tidy utility to handle offline/online connectivity like a Boss

559
Simple basic isolated apps budding flutter devs
Flutter Awesome

Simple basic isolated apps budding flutter devs

524
Next Post
A flutter widget showing a gridworld controlled

A flutter widget showing a GridWorld controlled

A resource to help developers evaluate and use flutter

A resource to help developers evaluate and use Flutter

A simple flutter app to track covid-19 cases

A simple Flutter app to track COVID-19 cases

  • Flutter & dart – the complete guide [2020 edition]

    Flutter & Dart – The Complete Guide [2020 Edition]

    2267 shares
    Share 907 Tweet 567
  • The Complete 2020 Flutter Development Bootcamp with Dart

    1989 shares
    Share 796 Tweet 497
  • Flutter & Firebase: Build a Complete App for iOS & Android

    1413 shares
    Share 565 Tweet 353
  • Flutter Bloc & Cubit Tutorial

    1288 shares
    Share 515 Tweet 322
  • 40 Beautiful Flutter UI Themes For Developers

    1067 shares
    Share 427 Tweet 267

Made by Google

Flutter is Google’s portable UI toolkit for building beautiful, natively-compiled applications for mobile, web, and desktop from a single codebase.

Follow us

Recent Post

  • Final vs Const – Programming #Shorts
  • Unsplash iOS app – UI ideas for flutter
  • Flutter UI Tip 3: Popup Card
  • Quill marketing site – UI ideas for flutter
  • [4K] PBO DART 22. Operator Overriding

Popular Post

Unity dashboard kit

Unity Dashboard Kit – UI ideas for flutter

657
Create beautiful forms in flutter

Create Beautiful Forms in Flutter

552

Review Post

Flutter themeswitcher template in flutter

Flutter ThemeSwitcher Template in Flutter

Congratulations, Nice Work, GLWS $7
Rosen – flutter ecommerce ui

Rosen - Flutter Ecommerce UI

Nice Product I am gonna love it. $18
  • [email protected]
  • Flutter Terms
  • Flutter Packages
  • Dart

Copyright © 2021 Flutter Website - by Flutter Team.

No Result
View All Result
  • Home
  • Categories
    • Flutter App
    • Flutter Examples
    • Flutter Github
    • Flutter News
    • Flutter PDF
    • Flutter Tips & Trick
    • Flutter Tutorial
    • Flutter UI
    • Flutter Video
    • Flutter VS
    • Flutter Wiki
    • Flutter With
  • Flutter
    • Flutter for Mobile
    • Flutter for Web
      • Widget Sample
    • Flutter for Desktop
    • Tools
      • Codemagic
      • Flutter Studio
      • Supernova
  • Showcase
  • Community
  • Advertisement
  • Hire Us
  • Login
  • Sign Up

Copyright © 2021 Flutter Website - by Flutter Team.

Welcome Back!

Sign In with Facebook
Sign In with Google
OR

Login to your account below

Forgotten Password? Sign Up

Create New Account!

Sign Up with Facebook
Sign Up with Google
OR

Fill the forms below to register

All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In
This website uses cookies. By continuing to use this website you are giving consent to cookies being used. Visit our Privacy and Cookie Policy.
Go to mobile version