esc_pos_bluetooth
Flutter & Dart 用の ESC/POS(熱転写、レシート)印刷(Android/iOS)
- スター
- 270
- フォーク
- 361
- 最終プッシュ(UTC)
- 2024/04/08
- プロジェクト状態
- 公開中
元の README
以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。
esc_pos_bluetooth
The library allows to print receipts using a Bluetooth printer. For WiFi/Ethernet printers, use esc_pos_printer library.
TODO (PRs are welcomed!)
- Split byte data into chunks: issue
- Print QR Codes using the
GS ( kcommand (printing QR code from an image already supported) - PDF-417 Barcodes using the
GS ( kcommand - Line spacing using the
ESC 3 <n>command
How to Help
- Test your printer and add it in the table: Wifi/Network printer or Bluetooth printer
- Test and report bugs
- Share your ideas about what could be improved (code optimization, new features...)
- PRs are welcomed!
Tested Printers
Here are some printers tested with this library. Please add the models you have tested to maintain and improve this library and help others to choose the right printer.
Generate a Ticket
Simple Ticket with Styles:
Ticket testTicket() {
final Ticket ticket = Ticket(PaperSize.mm80);
ticket.text(
'Regular: aA bB cC dD eE fF gG hH iI jJ kK lL mM nN oO pP qQ rR sS tT uU vV wW xX yY zZ');
ticket.text('Special 1: àÀ èÈ éÉ ûÛ üÜ çÇ ôÔ',
styles: PosStyles(codeTable: PosCodeTable.westEur));
ticket.text('Special 2: blåbærgrød',
styles: PosStyles(codeTable: PosCodeTable.westEur));
ticket.text('Bold text', styles: PosStyles(bold: true));
ticket.text('Reverse text', styles: PosStyles(reverse: true));
ticket.text('Underlined text',
styles: PosStyles(underline: true), linesAfter: 1);
ticket.text('Align left', styles: PosStyles(align: PosAlign.left));
ticket.text('Align center', styles: PosStyles(align: PosAlign.center));
ticket.text('Align right',
styles: PosStyles(align: PosAlign.right), linesAfter: 1);
ticket.text('Text size 200%',
styles: PosStyles(
height: PosTextSize.size2,
width: PosTextSize.size2,
));
ticket.feed(2);
ticket.cut();
return ticket;
}
You can find more examples here: esc_pos_utils.
Print a Ticket
PrinterBluetoothManager printerManager = PrinterBluetoothManager();
printerManager.scanResults.listen((printers) async {
// store found printers
});
printerManager.startScan(Duration(seconds: 4));
// ...
printerManager.selectPrinter(printer);
final PosPrintResult res = await printerManager.printTicket(testTicket());
print('Print result: ${res.msg}');
For a complete example, check the demo project example/blue.
Troubleshooting
- If your printer prints only 5%-10% of an image and then stops, or it can't print more than 1 image on the same ticket, or it can't print long tickets, try to ajust
queueSleepTimeMsof thePrinterBluetoothManager.printTicket(try 50 or 100ms):printerManager.printTicket(await demoReceipt(paper), queueSleepTimeMs: 50);
Test Print
言語DartRubyObjective-CKotlin
カテゴリー
使用している依存関係
依存関係一覧 5 件
- flutter
{"sdk":"flutter"} - rxdart
^0.26.0 - esc_pos_utils
^1.1.0 - flutter_bluetooth_basic
^0.1.7 - flutter_test開発用
{"sdk":"flutter"}
プロジェクトに合うリポジトリを選ぶには?
用途で絞り込み、開発状況を比較し、採用前に元のリポジトリで要件を確認しましょう。
- 名前・作者・説明で検索し、技術トピックで絞り込みます。
- スター、フォーク、最近のプッシュを比較します。スターは関心の目安であり、品質の保証ではありません。
- 利用前に GitHub で README、ライセンス、Issues を確認します。
情報源と管理
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗