flutter_savanitdev_printer 1.2.3

SDKflutter
Platformandroidios

this package create by savanitdev for using printer and support any language

flutter_savanitdev_printer

Xprinter SDK

Laos

สำหรับภาษาลาวสามารถใช้งานได้แต่ต้องเป็นปริ้นเตอร์ที่รองรับภาษาลาวเท่านั้นก็ขอบใจ ^^

Thai

สวัสดีครับผม
libraryที่ผมสร้างขึ้นมาเพื่อตอบสนองต่อผู้ใช้งานที่ต้องการปริ้นภาษาไทยและภาษาเวียดนามถ้าหากว่าใช้งานพบเจอปัญหาสามารถแจ้งผมมาได้เลยนะครับผมขอขอบคุณครับ ^^

VietNam

Xin chào, đây là thư viện tôi tạo ra để đáp ứng cho người dùng muốn in tiếng Thái và tiếng Việt. Nếu bạn gặp bất kỳ vấn đề gì khi sử dụng, bạn có thể thông báo cho tôi. Tôi xin cảm ơn bạn ^^.

Getting Started

This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.

For help getting started with Flutter development, view the online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Link React Native

Alert

  • currently I config just support for Thai languages and Vietnam 📍 if you need print more languages please contact me ^^

Support Printer ESC

  • XPrinter
  • Barigan
  • Welltech
  • Epson
  • VPOS
  • Sunmi
  • iMin

Support

| Expo | ✅
| React Native CLI | ✅ | Flutter CLI | ✅

ImplementAndroidIOS
imageBase64✅✅
print check printer✅✅
cancel Chinese✅✅
set code page✅✅
print test code page✅✅

auto change languages Thai and Vietnam ✅: Full option contact me print info printer ✅: Full option contact me set codePage ✅: Full option contact me need more languages ✅ contact me

Support

PrinterAndroidIOS
BLUETOOTH✅✅
Net✅✅
USB✅❌

Example multiple printing 5 printers

  • support print WIFI,BTE and USB in one time

https://youtu.be/hyEmWCuuu-g?si=ZGrFVPcgChBbS6Kx

Installation


screenshot bill bill screenshot

Link download APK test app

How to install package Android

  1. Copy this code to AndroidManfest.xml
  • Create folder xml/device_filter.xml
<!-- 0x10C4 / 0xEA??: Silabs CP210x -->
<usb-device vendor-id="4292" product-id="60000" /> <!-- 0xea60: CP2102 -->
<usb-device vendor-id="4292" product-id="60016" /> <!-- 0xea70: CP2105 -->
<usb-device vendor-id="4292" product-id="60017" /> <!-- 0xea71: CP2108 -->
<usb-device vendor-id="4292" product-id="60032" /> <!-- 0xea80: CP2110 -->

<!-- 0x067B / 0x2303: Prolific PL2303 -->
<usb-device vendor-id="1659" product-id="8963" />

<!-- 0x1a86 / 0x?523: Qinheng CH34x -->
<usb-device vendor-id="6790" product-id="21795" /> <!-- 0x5523: CH341A -->
<usb-device vendor-id="6790" product-id="29987" /> <!-- 0x7523: CH340 -->

<!-- CDC driver -->
<usb-device vendor-id="9025" />                   <!-- 0x2341 / ......: Arduino -->
<usb-device vendor-id="5824" product-id="1155" /> <!-- 0x16C0 / 0x0483: Teensyduino  -->
<usb-device vendor-id="1003" product-id="8260" /> <!-- 0x03EB / 0x2044: Atmel Lufa -->
<usb-device vendor-id="7855" product-id="4"    /> <!-- 0x1eaf / 0x0004: Leaflabs Maple -->
<usb-device vendor-id="3368" product-id="516"  /> <!-- 0x0d28 / 0x0204: ARM mbed -->
<!--    zywell-->
<usb-device vendor-id="1155" product-id="22339"  />

Setup IOS Add below code into info.plist

  • NSBluetoothAlwaysUsageDescription

  • we needed to discover nearby devices, such as a thermal printer and print receipts.

  • NSBluetoothPeripheralUsageDescription

  • We needed to discover nearby devices, connect to a thermal printer and print receipts.

  • install package for test : 1.esc_pos_utils_plus 2.flutter_charset_savanitdev

Generate a Ticket

Simple ticket with styles:

  final profile = await CapabilityProfile.load();
    final generator = Generator(PaperSize.mm80, profile);
    List<int> bytes = [];

    final ByteData data = await rootBundle.load('assets/images/logo.png');
    final Uint8List imgBytes = data.buffer.asUint8List();
    final img.Image image = img.decodeImage(imgBytes)!;

    bytes +=
        generator.imageRaster(img.copyResize(image, width: 130, height: 130));
    bytes += generator.text(" ");
    bytes += generator.text("SavanitDev Shop",
        styles: PosStyles(
            align: PosAlign.center, bold: true, height: PosTextSize.size1));
    bytes += generator.text(" ");
    bytes += generator.textEncoded(
        useEncode(
            _selectedLang == "TH" ? "หมายเลขโต๊ะ : 12345" : "số bàn : 12345"),
        styles: PosStyles(align: PosAlign.center));
    bytes += generator.text(" ");
    bytes += generator.textEncoded(
        useEncode(
            _selectedLang == "TH" ? "วันที่ 25/05/2024" : "ngày 25/05/2024"),
        styles: PosStyles(align: PosAlign.center));
    bytes += generator.text(" ");

    bytes += generator.row([
      PosColumn(
          textEncoded: useEncode(_selectedLang == "TH" ? "สินค้า" : "sản phẩm"),
          width: 7,
          styles: PosStyles(align: PosAlign.left)),
      PosColumn(
          textEncoded: useEncode(_selectedLang == "TH" ? "จำนวน" : "Số lượng"),
          width: 3,
          styles: PosStyles(align: PosAlign.left)),
      PosColumn(
          textEncoded: useEncode(_selectedLang == "TH" ? "ราคา" : "giá"),
          width: 2,
          styles: PosStyles(align: PosAlign.right)),
    ]);
    final arr = [
      {
        "name": "ปอเปี๊ยะทอด",
        "qty": "2",
        "price": "1000.00",
      },
      {
        "name": "อาหารไทย หมี่กรอบ",
        "qty": "2",
        "price": "45.00",
      },
      {
        "name": "กุ้งลายโสร่ง,ประทัดลม,ทอดมันกุ้ง",
        "qty": "2",
        "price": "500.00",
      },
      {
        "name": "หมู, เนื้อผึ่งแดดทอด",
        "qty": "2",
        "price": "10500.00",
      },
    ];
    for (var i = 0; i < arr.length; i++) {
      final rep = arr[i];
      bytes += generator.row([
        PosColumn(
            textEncoded: useEncode(_selectedLang == "TH"
                ? rep["name"].toString()
                : "món ăn việt nam"),
            width: 7,
            styles: PosStyles(align: PosAlign.left)),
        PosColumn(
            text: rep["qty"].toString(),
            width: 2,
            styles: PosStyles(align: PosAlign.left)),
        PosColumn(
            textEncoded: useEncode(_selectedLang == "TH"
                ? "${rep["price"].toString()} บาท"
                : "100.000 đồng"),
            width: 3,
            styles: PosStyles(align: PosAlign.right)),
      ]);
    }
    bytes += generator.row([
      PosColumn(
          textEncoded:
              useEncode(_selectedLang == "TH" ? "ทั้งหมด" : "tổng cộng"),
          width: 5,
          styles: PosStyles(align: PosAlign.left)),
      PosColumn(
        text: "",
        width: 1,
        styles: PosStyles(align: PosAlign.center),
      ),
      PosColumn(
          textEncoded:
              useEncode(_selectedLang == "TH" ? "500 บาท" : "100.000 đồng"),
          width: 6,
          styles: PosStyles(align: PosAlign.right)),
    ]);
    bytes += generator.row([
      PosColumn(
          textEncoded: useEncode(_selectedLang == "TH" ? "ลดราคา" : "giảm giá"),
          width: 5,
          styles: PosStyles(align: PosAlign.left)),
      PosColumn(
        text: "",
        width: 1,
        styles: PosStyles(align: PosAlign.center),
      ),
      PosColumn(
          textEncoded:
              useEncode(_selectedLang == "TH" ? "500 บาท" : "100.000 đồng"),
          width: 6,
          styles: PosStyles(align: PosAlign.right)),
    ]);
    bytes += generator.row([
      PosColumn(
          textEncoded: useEncode(
              _selectedLang == "TH" ? "ค่าบริการ 10%" : "Phí dịch vụ 10%"),
          width: 5,
          styles: PosStyles(align: PosAlign.left)),
      PosColumn(
        text: "",
        width: 1,
        styles: PosStyles(align: PosAlign.center),
      ),
      PosColumn(
          textEncoded:
              useEncode(_selectedLang == "TH" ? "50 บาท" : "10.000 đồng"),
          width: 6,
          styles: PosStyles(align: PosAlign.right)),
    ]);
    bytes += generator.row([
      PosColumn(
        text: "VAT 7%",
        width: 5,
        styles: PosStyles(align: PosAlign.left),
      ),
      PosColumn(
        text: "",
        width: 1,
        styles: PosStyles(align: PosAlign.center),
      ),
      PosColumn(
          textEncoded:
              useEncode(_selectedLang == "TH" ? "50 บาท" : "10.000 đồng"),
          width: 6,
          styles: PosStyles(align: PosAlign.right)),
    ]);
    bytes += generator.hr(ch: "-");
    bytes += generator.row([
      PosColumn(
          textEncoded:
              useEncode(_selectedLang == "TH" ? "ทั้งหมด" : "tổng cộng"),
          width: 5,
          styles: PosStyles(align: PosAlign.left, bold: true)),
      PosColumn(
        text: "",
        width: 1,
        styles: PosStyles(align: PosAlign.center),
      ),
      PosColumn(
          textEncoded:
              useEncode(_selectedLang == "TH" ? "50 บาท" : "10.000 đồng"),
          width: 6,
          styles: PosStyles(align: PosAlign.right, bold: true)),
    ]);
    bytes += generator.hr(ch: "-");
    bytes += generator.text(" ");
    bytes += generator.text("Scan QR code for visit my Facebook",
        styles: PosStyles(align: PosAlign.center));
    bytes += generator.text(" ");
    bytes += generator.qrcode("https://www.facebook.com/SavanitDev",
        size: QRSize.Size8);

    bytes += generator.text(" ");
    bytes += generator.hr(ch: ".");
    bytes += generator.text(" ");
    bytes +=
        generator.text("Thank you", styles: PosStyles(align: PosAlign.center));

    bytes += generator.textEncoded(
        useEncode(_selectedLang == "TH"
            ? "สร้าง library นี้โดย"
            : "tạo thư viện này bởi"),
        styles: PosStyles(align: PosAlign.center));
    bytes += generator.textEncoded(
        useEncode("https://www.facebook.com/SavanitDev"),
        styles: PosStyles(align: PosAlign.center));

    bytes += generator.feed(2);
    bytes += generator.cut();
    String base64String = base64Encode(bytes);

    if (_selectedType == "NET") {
      await _savanitdevPlugin.printRawData(addressPrinter, base64String, false);
    } else if (_selectedType == "BLE") {
      await _savanitdevPlugin.rawDataBLE(base64String);
    } else {
      if (Platform.isAndroid) {
        await _savanitdevPlugin.printRawData(
            addressPrinter, base64String, false);
      }
    }

Support Full Options printer or give me coffee 🔰🔰🔰

BIDV ViteNam bill

OnePay BCEL Laos bill

Binance Pay bill

USDT (TRC20) : THkJtfAKZVCvTxifDGa4NLZQrUJYbUZ2Rs bill

Support Me by give Star ⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️⭐️

Star the SavanitDev repo on GitHub to support the project

FAQ Support 🔰🔰🔰

you can contact me directly Telegram, feedback your problem

or ✉️

Telegram : @dev_la Fanpage : https://www.facebook.com/SavanitDev

Thank you guys