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

fp_bt_printer 封面
插件详情v0.0.3

fp_bt_printer

在蓝牙热敏打印机上打印收据(仅限 Android)。

Android
近 30 天下载
35
喜欢数
23
Pub 分数
125

安装插件

flutter pub add fp_bt_printer

插件介绍

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

一个用于在蓝牙热敏打印机上打印收据的Flutter包,专为Android设备设计。它可实现与兼容蓝牙打印机的无缝通信,直接从移动应用发送打印命令。适用于销售点系统、零售自助终端以及需要随时随地打印收据的小型企业应用。该包高效处理配对、连接管理和数据传输。依赖原生Android蓝牙API,不支持iOS或其他平台。

适合场景

  • 销售点系统
  • 零售收据打印
  • 移动自助服务终端应用程序
  • 事件票务打印
  • 现场订单处理

主要特点

  • 蓝牙热敏打印机集成
  • 仅支持 Android
  • 收据文本和图像打印
  • 自动打印机发现
  • 打印命令的简单API

适合对象

  • Android 开发者
  • 零售应用创建者
  • POS系统集成商
  • 小型企业软件
  • 移动打印解决方案

使用建议

  • 需要安卓设备
  • 仅限蓝牙热敏打印机
  • 不支持 iOS
  • 需要在 AndroidManifest.xml 中设置正确的权限
  • 必须验证打印机兼容性

原始 README

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

fp_bt_printer

This library allows printing receipts on bluetooth thermal printers (android only). Support 58mm and 80mm printer.

It allows to print QR, BarCode, Images RasterImages with the esc_pos_utils package.

List bounded devices

Get list of bluetooth devices, it supports any version of bluetooth, not just BLE.

    List<PrinterDevice> devices = [];
    FpBtPrinter printer = FpBtPrinter();

    Future<void> getDevices() async {
        final response = await printer.scanBondedDevices();
        setState(() {
        devices = response;
        });
    }
Check device connected

You can check that the connection with the device is correct.

    Future<void> setConnet(PrinterDevice d) async {
        final response = await printer.checkConnection(d.address);
        print(response.message);
    }
Print data

This method recibe address of the printer and List of the data;

    FpBtPrinter printer = FpBtPrinter();
    final resp = await printer.printData(bytes, address: address);
    if (resp.success) {
     //print ok
    } else {
    print(resp.message); //print error
    }
Ticket with Styles usin :
List<int> getTicket() {
  final List<int> bytes = [];
  // Using default profile
  final profile = await CapabilityProfile.load();
    final generator = Generator(PaperSize.mm80, profile);
    List<int> bytes = [];

    // //  Print image:
    final ByteData data = await rootBundle.load('assets/wz.png');
    final Uint8List bytesImg = data.buffer.asUint8List();
    var image = decodePng(bytesImg);

    // resize
    var thumbnail =
        copyResize(image!, interpolation: Interpolation.nearest, height: 200);

    bytes += generator.text("fp_bt_printer",
        styles: PosStyles(align: PosAlign.center, bold: true));

    bytes += generator.imageRaster(thumbnail, align: PosAlign.center);

    bytes += generator.reset();
    bytes += generator.setGlobalCodeTable('CP1252');
    bytes += generator.feed(1);
    bytes += generator.text("HELLO PRINTER by FPV",
        styles: PosStyles(align: PosAlign.center, bold: true));
    bytes += generator.qrcode("https://github.com/FranciscoPV94",
        size: QRSize.Size6);
    bytes += generator.feed(1);
    bytes += generator.feed(1);

    final resp = await printer.printData(bytes, address: address);
  return bytes;
}

Tested and working with following Bluetooth Thermal Printers:

Xprinter Portable Thermal Printer

Model: Bixolon SPP-R310

Evidence

test receipt

Support me

If you think that this project has helped you with your developments, you can support this project, any support is much appreciated. Paypal

所属分类

依赖

依赖清单 1 项

源码仓库

使用此插件的项目

暂无相关数据。