sunmi_task_printer 0.0.3 copy "sunmi_task_printer: ^0.0.3" to clipboard
sunmi_task_printer: ^0.0.3 copied to clipboard

PlatformAndroid

A comprehensive software package to effectively manage Sunmi printers and their drivers, ensuring seamless printing operations.

sunmi_task_printer #

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, because i don't have equipment. If you have and can help me, just contact me on github!

Installation #

flutter pub add sunmi_task_printer

What this package do #

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

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_task_printer/sunmi_task_printer.dart';

// all method from sunmi printer need to async await
await SunmiPrinter.bindingPrinter(); // must bind the printer first. for more example.. 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/FrenkyDema/sunmi_task_printer'); // PRINT A QRCODE
await SunmiPrinter.submitTransactionPrint(); // SUBMIT and cut paper
await SunmiPrinter.exitTransactionPrint(true); // Close the transaction

Example code for LCD functions #

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 Unit8List 
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 alignment

Example to open the cashier #

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 the cash drawer was opened

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

This is a fork from sunmi_printer_plus #

3
likes
140
points
25
downloads

Publisher

verified publisherfrancescodema.dev

Weekly Downloads

A comprehensive software package to effectively manage Sunmi printers and their drivers, ensuring seamless printing operations.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on sunmi_task_printer