搜尋套件、儲存庫與 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 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。