sunmi_printer_pro

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

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_pro

What this package do

  • 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 Underline mode on/off
  • 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)

Tested Devices

sunmi_printer_proSunmiPrinterPro

Sunmi V2 Pro 
Sunmi T2 mini
IPos B08
// import packages
import 'package:sunmi_printer_pro/sunmi_printer_pro.dart';


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

Example code when use for transaction printing

  await SunmiPrinterPro.startTransactionPrint(true);

  // Right align
  await SunmiPrinterPro.printText('Align right',sunmiPrintAlign: SunmiPrintAlign.right);

  // Left align
  await SunmiPrinterPro.printText('Align left',sunmiPrintAlign: SunmiPrintAlign.left);

  // Center align
  await SunmiPrinterPro.printText('Align center',sunmiPrintAlign: SunmiPrintAlign.center,);

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

  // Set font to very large
  await SunmiPrinterPro.printText('Very Large font!',fontSize: 36);

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

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,
}