搜索插件、代码仓与 APP 分类

插件详情v1.0.3

flutter_esc_pos_network

该库允许使用热敏Wi-Fi/以太网打印机通过ESC/POS命令打印收据。

AndroidiOSmacOSWindowsLinux
近 30 天下载
2770
喜欢数
30
Pub 分数
130

安装插件

flutter pub add flutter_esc_pos_network

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个 Flutter 包,通过 Wi-Fi 或以太网连接的热敏打印机支持 ESC/POS 命令进行收据打印。它利用标准 ESC/POS 协议与网络打印机通信,非常适合用于销售点系统和零售应用。该库支持多种平台,包括 Android、iOS、macOS、Windows 和 Linux,确保跨平台兼容性。开发者可以直接从其 Flutter 应用向打印机发送格式化文本、条形码和图像。

适合场景

  • 销售点系统
  • 零售收据打印
  • 餐厅订单打印
  • 库存管理
  • 事件票务打印

主要特点

  • Wi-Fi 和以太网打印机支持
  • ESC/POS 命令兼容性
  • 跨平台功能
  • 文本、条形码和图像打印
  • 与 Flutter 应用的简单集成

适合对象

  • 零售开发者
  • POS应用创建者
  • 需要打印的移动应用开发者
  • 具有网络热敏打印机的业务
  • 物联网支持的自助服务终端解决方案

使用建议

  • 需要兼容的ESC/POS打印机
  • 需要网络配置
  • 打印机IP地址必须已知
  • 仅限联网设备
  • 无内置打印机发现功能

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

flutter_esc_pos_network

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, iOS, windows, Linux and MacOS 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 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: flutter_esc_pos_utils.

Print a Receipt

import 'package:flutter_esc_pos_network/flutter_esc_pos_network.dart';
final printer = PrinterNetworkManager('192.168.1.100');
    PosPrintResult connect = await printer.connect();
    if (connect == PosPrintResult.success) {
      PosPrintResult printing = await printer.printTicket(ticket);

      print(printing.msg);
      printer.disconnect();
    }
  }

For a complete example, check example/example.dart

所属分类

依赖

依赖清单 1 项

源码仓库

使用此插件的项目

暂无相关数据。