pos_printer_kit_khmer 1.0.9
pos_printer_kit_khmer: ^1.0.9 copied to clipboard
A Flutter library for printing receipts in Khmer using ESC/POS-compatible thermal printers.
๐งพ POS Printer Kit Khmer #
A Flutter plugin to print Khmer invoices on ESC/POS network thermal printers. This package allows:
โ
Khmer Unicode Text
โ
Receipt as Image
โ
Custom Layout Screenshot Printing
โ
Full-width support for 80mm paper
๐ Features #
- Print Khmer text using a custom font
- Render invoice layout as image
- Print from screenshot
- Easily connect to printer via IP and port
๐ Installation #
Add to your pubspec.yaml:
pos_printer_kit_khmer: ^1.0.0
๐ฆ Usage #
Import and Connect #
import 'package:pos_printer_kit_khmer/pos_printer_kit_khmer.dart';
final PrinterService printerService = PrinterService();
@override
void initState() {
super.initState();
_connectToPrinter();
}
Future<void> _connectToPrinter() async {
const String ip = '192.168.0.100'; // your printer ip for eg. 168.10.10.0
const int port = 9100;
printerService.setConnection(ip: ip, port: port); // Replace with your actual IP
} // Replace with your actual IP
โ Khmer Unicode Text #
await printerService.printKhmerRawText([
'แแทแแแแแแแแ INV-001',
'แขแแทแแทแแ: แแแ แ
แถแแแแถแแแถ',
'แแแปแ: \$10.00',
'แแผแแขแแแปแ!',
]);
โ Receipt as Image #
await printerService.printKhmerTextAsImage('แแทแแแแแแแแ: INV-0001');
โ Full-width support for 80mm paper #
await printerService.printInvoiceImage(
title: 'COMPANY NAME CO., LTD.',
customer: 'แแแ แ
แถแแแแถแแแถ',
invoiceNo: 'INV-001',
dateTime: DateTime.now(),
items: [
InvoiceItem(name: 'แแถแ แแแแแแแ แ', qty: 1, price: 2.0),
InvoiceItem(name: 'แแแแแ', qty: 2, price: 4.0),
InvoiceItem(name: 'แแนแแแแแแแพ', qty: 1, price: 1.5),
],
discount: 0.5,
paymentMethod: 'แแถแ
แแแแแถแแ',
);
โ Custom Layout Screenshot Printing #
final GlobalKey captureKey = GlobalKey();
RepaintBoundary(
key: captureKey,
child: YourInvoiceWidget(),
);
await printerService.printFromScreenshot(captureKey);