esc_pos_printer icon indicating copy to clipboard operation
esc_pos_printer copied to clipboard

feat: USB Printers

Open iRaySpace opened this issue 4 years ago • 9 comments

Description:

  • Be able to select USB devices
  • Be able to write bytes to printer with/without Ticket class

Tested on Issyzone POS - ITPP047

Feedback are welcome!

Regards,

Bai Web and Mobile Lab Team

iRaySpace avatar Apr 01 '20 09:04 iRaySpace

Hello @andrey-ushakov we have created a PR that will allow the package to support USB. Hope you can review and merge. Thanks!

ccfiel avatar Apr 03 '20 11:04 ccfiel

Hi @iRaySpace , @ccfiel ,

Thank you for your contribution! Unfortunately, I can't review and test it right now but for sure I will do that once I will get a USB printer!

andrey-ushakov avatar Apr 04 '20 09:04 andrey-ushakov

@iRaySpace your writeBytes method doesn't work properly. I changed a few things and it worked for big tickets

` Future<PosPrintResult> writeBytes(List bytes, {int chunkSizeBytes = 8192, int queueSleepTimeMs = 200,}) async { final Completer<PosPrintResult> completer = Completer();

final List<List<int>> chunks = [];

final len = bytes.length;

//check if total length is lower than chunkSize
if (bytes.length <= chunkSizeBytes) {
  chunks.add(bytes);
} else {
  for (var i = 0; i < len; i += chunkSizeBytes) {
    final end = (i + chunkSizeBytes < len) ? i + chunkSizeBytes : len;
    chunks.add(bytes.sublist(i, end));
  }
}

for (List<int> data in chunks) {
  await Escposprinter.printBytes(data);
  sleep(Duration(milliseconds: queueSleepTimeMs));
}

completer.complete(PosPrintResult.success);

await Escposprinter.closeConn;

return completer.future;

}`

ibrahimlee avatar Sep 18 '20 07:09 ibrahimlee

@iRaySpace

I am getting this warning :

Note: C:\src\flutter\.pub-cache\git\esc-pos-printer-flutter-3dbaca068eac03e141745d6328758cc422c24bcb\android\src\main\java\br\com\samhaus\escposprinter\EscposprinterPlugin.java uses unchecked or unsafe operations.

talhakhan1297 avatar Sep 25 '20 14:09 talhakhan1297

any update? test good for me.

fanchou avatar Jan 23 '21 02:01 fanchou

Does this work in the web or Windows? @iRaySpace @ccfiel

LucaDillenburg avatar Mar 14 '22 22:03 LucaDillenburg

It is written only for Android. Other platforms were not taken into account. @LucaDillenburg

iRaySpace avatar Mar 18 '22 15:03 iRaySpace

Does this work in the web or Windows? @iRaySpace @ccfiel

Hi, In fact, on the web you will never have it for security reasons, your system does not have access to the printers, unless it shows the print screen before (never directly)

Now windows I'm on the search right now 😅😁

EwertonDutra avatar Apr 17 '22 15:04 EwertonDutra

Hi All, Is there any posibility to use printer which is connected via USB in Windows?

SachinCodeMatrix avatar Aug 24 '22 18:08 SachinCodeMatrix