搜尋套件、儲存庫與 APP 分類

套件詳情v4.2.0

sunmi_printer_plus

支援 V2 Pro Sunmi 標籤版本與空值安全性。使用此套件,您可以連接 Sunmi 印表機,列印文字、影像、QR 碼、條碼,以及您喜歡的自訂 Esc/Pos。

Android
近 30 天下載
2.8萬
喜歡數
156
Pub 分數
160

安裝套件

flutter pub add sunmi_printer_plus

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

sunmi_printer_plus 包可實現與 Android 上 Sunmi V2 Pro 標籤列印機的無縫整合,支援空值安全性與自訂 Esc/Pos 命令。它允許開發者直接從 Flutter 應用程式列印文字、圖像、QR 碼與條碼。此包設計可靠且易於使用,提供簡潔的 API 將列印工作傳送至 Sunmi 硬體,非常適合需要標籤或收據列印的零售、物流及銷售點應用。

適用情境

  • 零售收據打印
  • 物流標籤列印
  • 銷售點系統
  • 庫存管理
  • 自定義 Esc/Pos 命令執行

主要特色

  • 支援Sunmi V2 Pro 標籤列印機
  • 空安全相容
  • 列印文字、圖像、二維碼、條碼
  • 自定義 Esc/Pos 命令支援
  • 僅限 Android 平台的相容性

適合對象

  • 面向 Sunmi 打印機的 Flutter 開發人員
  • 需要標籤列印的業務應用
  • POS系統整合
  • 移動庫存解決方案

使用建議

  • 僅限 Android
  • 需要相容的Sunmi硬體
  • 僅限基於 Esc/Pos 的列印
  • 不支援 iOS 或桌面端
  • 需要正確的設備權限

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

sunmi_printer_plus

This is a fork from sunmi_printer , but i implemented a lot of other features described below

Pub Monthly Downloads Pub Points Pub Likes GitHub Issues or Pull Requests GitHub contributors

Important:

THIS PACKAGE WILL WORK ONLY IN ANDROID!

Support Sunmi and Null Safety. I build this flutter plugin based on this: Official Sunmi Inner Printer Doc. But not all method from doc was included in this package, beacuse i don't have equipment. If you have and can help me, just contact me on github!

Installation

flutter pub add sunmi_printer_plus

What this package do

  • [x] Print in label mode (when avaliable!)
  • [x] Write some text (with style or not!)
  • [x] Change font size
  • [x] Jump (n) lines
  • [x] Draw a divisor line
  • [x] Bold mode on/off
  • [x] Print all types of Barcodes (see enum below)
  • [x] Print Qrcodes with custom width and error-level
  • [x] Print image from asset or from web (example show how to print both)
  • [x] Print rows like recepit with custom width and alignment
  • [x] Able to combine with some esc/pos code that you already have!
  • [x] Cut paper - Dedicated method just to cut the line
  • [x] Printer serial no - Get the serial number of the printer
  • [x] Printer version - Get the printer's version
  • [x] Printer paper size - Get the paper size ( 0: 80mm 1: 58mm)
  • [x] LCD Print a image ytyng
  • [x] LCD Print a string , multi lines as double lines Thanks to ytyng
  • [x] Open de cash drawer Thanks to ZheruiL
  • [x] Check if the cash drawer is connected or not
  • [x] Get how many times the cash drawer was oppened

Tested Devices

Sunmi V2 Pro 
Sunmi T2 mini
Sunmi V2S

You can also combine this package with the package esc_pos_utils

With this package you can create a custom escpos and than you don't need to use any other command. This is good if you already have a code that another printers use, and u can reuse this code as well

#Just see the example folder!

// import packages
import 'package:sunmi_printer_plus/sunmi_printer_plus.dart';


// all method from sunmi printer need to async await
await SunmiPrinter.bindingPrinter(); // must bind the printer first. for more exmaple.. pls refer to example tab.

Example code when use for transaction printing

  await SunmiPrinter.startTransactionPrint(true);

  await SunmiPrinter.setAlignment(SunmiPrintAlign.RIGHT); // Right align
  await SunmiPrinter.printText('Align right');

  await SunmiPrinter.setAlignment(SunmiPrintAlign.LEFT);// Left align
  await SunmiPrinter.printText('Align left');

  await SunmiPrinter.setAlignment(SunmiPrintAlign.CENTER);// Center align
  await SunmiPrinter.printText('Align center');

  await SunmiPrinter.lineWrap(2); // Jump 2 lines

  await SunmiPrinter.setFontSize(SunmiFontSize.XL); // Set font to very large
  await SunmiPrinter.printText('Very Large font!');
  await SunmiPrinter.resetFontSize(); // Reset font to medium size

  await SunmiPrinter.setCustomFontSize(12); // SET CUSTOM FONT 12
  await SunmiPrinter.printText('Custom font size!!!');
  await SunmiPrinter.resetFontSize(); // Reset font to medium size

  await SunmiPrinter.printQRCode('https://github.com/brasizza/sunmi_printer'); // PRINT A QRCODE
  await SunmiPrinter.submitTransactionPrint(); // SUBMIT and cut paper
  await SunmiPrinter.exitTransactionPrint(true); // Close the transaction

Example code for LCD functions @ytyng

 await SunmiPrinter.lcdInitialize(); //Initialize the LCD 
 await SunmiPrinter.lcdWakeup(); //Turn the LCD ON
 await SunmiPrinter.lcdSleep(); //Turn the LCD OFF
 await SunmiPrinter.lcdClear(); //Clear LCD screen
 await SunmiPrinter.lcdString('Hello'); //Write a simple line 
 await SunmiPrinter.lcdString('Hello'); //Write a simple line 
 await SunmiPrinter.lcdDoubleString('Hello', 'World'); //Write two lines

 Uint8List byte = await readFileBytes('assets/images/128x40.png');
 await SunmiPrinter.lcdImage(byte); // Put an image in LCD
 await SunmiPrinter.lcdFillString('abcDEFgj0123\$&=+', size: 16, fill: true); // Print a string and fill with zeros until the size is reached
 await SunmiPrinter.lcdMultiString([  'Welcome to flutter.',  'Align 2.',], [  1,  2,]); // Write multiple lines with alignent

Example to open the cashier @ZheruiL

  bool await SunmiPrinter.drawerStatus(); //check if the cash drawer is connect or disconnect

  await SunmiPrinter.openDrawer(); //open de cash drawer

  int await SunmiPrinter.drawerTimesOpen(); //How many times de cash drawer was oppened

List of enum printer mode
enum PrinterMode {
  NORMAL_MODE,
  BLACK_LABEL_MODE, 
  LABEL_MODE
}
List of enum Alignments
enum SunmiPrintAlign {
  LEFT,
  CENTER,
  RIGHT,
}
List of enum Qrcode levels
enum SunmiQrcodeLevel {
  LEVEL_L,
  LEVEL_M,
  LEVEL_Q,
  LEVEL_H,
}
List of enum Barcode types
enum SunmiBarcodeType {
  UPCA,
  UPCE,
  JAN13,
  JAN8,
  CODE39,
  ITF,
  CODABAR,
  CODE93,
  CODE128,
}
List of enum Text position in barcode
enum SunmiBarcodeTextPos {
  NO_TEXT,
  TEXT_ABOVE,
  TEXT_UNDER,
  BOTH,
}
List of enum Font sizes
enum SunmiFontSize {
  XS,
  SM,
  MD,
  LG,
  XL,
}

所屬分類

依賴

依賴清單 1 項

  • plugin_platform_interface^2.1.8

原始碼儲存庫

使用此套件的專案