Closed hamzamon closed 3 years ago
Does your POS / ESC have any Android SDK or Example? Usually decompiling java helps a lot
I am using Bixolon USB POS printer, but I could not find sdk to use in flutter. Can I send print command using quick_usb plugin ?
We mainly use quick_usb
together with TSC printers. TSC provides a lot of Android SDK/Examples so that we could decompile the Java code and write the same logic in Flutter
You'd better find the coresponding Android SDK or I couldn't help
I mean in desktop not android
It doesn't matter desktop or android, principle is same. You don't need any printer SDK or decompiling if your printer supports ESC/POS (i haven't seen one without it). Using example app
For number 5 to actually print something find line
var data = Uint8List.fromList(utf8.encode(''));
which doesn't actually sends anything, and replace it with this
var posBytes = [
// init printer
0x1B, // Esc
0x40, // @
// select character code table
0x1B, // Esc
0x74, // t
0x8, // 8 <-- location of CodePage 852 in my printer, usually 0x8 or 0x12
0x54, // T
0x45, // E
0x53, // S
0x54, // T
0x20, // Space
0xE6, // Š
0xD1, // Đ
0xAC, // Č
0x8F, // Ć
0xA6, // Ž
0xE7, // š
0xD0, // đ
0x9F, // č
0x86, // ć
0xA7, // ž
//add new line
0x0D, // CR (carriage return)
0x0A, // NL (new line)
//add new line
0x0D, // CR (carriage return)
0x0A, // NL (new line)
//add new line
0x0D, // CR (carriage return)
0x0A, // NL (new line)
//add new line
0x0D, // CR (carriage return)
0x0A, // NL (new line)
// init printer
0x1B, // Esc
0x40, // @
];
await QuickUsb.detachKernelDriver(_configuration.interfaces[0]);
var data = Uint8List.fromList(posBytes);
If you printer has code page 852 stored at location 0x8 in printer memory you should see
TEST ŠĐČĆŽšđčćž
There are plenty of libraries on pub.dev that allow you to convert commands to sequence of bytes.
Thank you a lot, let me try and will update.
Any update on this?
What kind of update? Have you tried the to run the example?
Yes, but without any luck. I am attempting to use a thermal printer from and android tablet using a USB connection.
If I understand correctly, you followed my instructions from above and printer did not print anything? If that is the case than either your printer does not support ESC/POS commands (highly unlikely if it's POS receipt printer), or you misconfigured something. Double check if you followed my instructions and selected right port/interface in the code (example always uses first). Bottom line this library already supports sending bytes to POS printer, there's nothing more to be done. And it works so on Linux, MacOS and Android (haven't tested it on Windows since it's pain in the ass). Library itself just sends bytes you provided to interface/configuration you select. It doesn't implement ESC/POS commands, find a lib on pub.dev that implements ESC/POS commands, use that same lib to convert those commands to bytes and then use this lib to transfer bytes to usb printer.
My bad, it had nothing to do with printing, but simply my pubspec.yaml file which did not match the package.
Thanks for the elaborate answer by the way! I tried following the steps, and the printer appears on the app (as the only device), and the message "bulkTransferOut 30" appears when I click , but the printer does not print.
thanks, it works for me. my steps:
init ---> getDevicesWithDescription --> select device ---> openDevice---> getConfiguration--->claimInterface---> bulkTransferOut
I use esc_pos_utils for the base ESC/POS command package.
nice to hear fanchou. Could you by any chance share an example combining the esc_pos_utils with the quick_usb packages?
For anyone interested in Flutter Desktop: https://github.com/leanflutter/awesome-flutter-desktop
WeChat: wk2311007 (for @fanchou 周凡) Discord: https://discord.gg/vba8W9SF
nice to hear fanchou. Could you by any chance share an example combining the esc_pos_utils with the quick_usb packages?
https://github.com/fanchou/flutter_escpos just test on Mac now
thanks!!
How to send byte data to the printer in windows ?
On Mon, Sep 13, 2021 at 12:00 PM 周凡 @.***> wrote:
thanks, it works for me. my steps:
init ---> getDevicesWithDescription --> select device ---> openDevice---> getConfiguration--->claimInterface---> bulkTransferOut
I use esc_pos_utils https://github.com/andrey-ushakov/esc_pos_utils for the base ESC/POS command package.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/woodemi/quick_usb/issues/20#issuecomment-917882160, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGJEFMNOECCH3QFJX4QPEE3UBWLARANCNFSM45VZ63MA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
How to send byte data to the printer in windows ?
This issue is resolved and should be closed 🔒 Plugin supports POS printers ad well as any USB device, and example has been provided. Please keep in mind this is not general forum and discussion should be plugin specific.
How to send POS / ESC print commands to the printer device, can you give me an example ?