andrey-ushakov / esc_pos_printer

ESC/POS (thermal, receipt) printing for Flutter & Dart
BSD 3-Clause "New" or "Revised" License
356 stars 318 forks source link

Error on imageRaster function #94

Open sbrsubuvga opened 3 years ago

sbrsubuvga commented 3 years ago

on print image raster getting an error

E/flutter (29670): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: RangeError (index): Invalid value: Not in inclusive range 0..152976: 152977
E/flutter (29670): #0      List.[] (dart:core-patch/growable_array.dart:177:60)
E/flutter (29670): #1      Ticket._packBitsIntoBytes (package:esc_pos_utils/src/ticket.dart:566:16)
E/flutter (29670): #2      Ticket._toRasterFormat (package:esc_pos_utils/src/ticket.dart:675:12)
E/flutter (29670): #3      Ticket.imageRaster (package:esc_pos_utils/src/ticket.dart:694:38)
E/flutter (29670): #4      _PrinterEntryState.testTicket (package:project/printerEntry.dart:556:15)
E/flutter (29670): <asynchronous suspension>
E/flutter (29670): #5      _PrinterEntryState.testPrint (package:project/printerEntry.dart:503:24)
E/flutter (29670): <asynchronous suspension>
E/flutter (29670): 
mjafartp commented 3 years ago

Latest Ver. also have the same error on printing generated image

E/flutter ( 7499): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: RangeError (index): Invalid value: Not in inclusive range 0..1584016: 1584017 E/flutter ( 7499): #0 List.[] (dart:core-patch/growable_array.dart:183:60) E/flutter ( 7499): #1 Generator._packBitsIntoBytes (package:esc_pos_utils/src/generator.dart:207:16) E/flutter ( 7499): #2 Generator._toRasterFormat (package:esc_pos_utils/src/generator.dart:193:12) E/flutter ( 7499): #3 Generator.imageRaster (package:esc_pos_utils/src/generator.dart:629:38) E/flutter ( 7499): #4 _MyHomePageState.testTicket (package:discover_printers/main.dart:192:26) E/flutter ( 7499): E/flutter ( 7499): #5 _MyHomePageState.testPrint (package:discover_printers/main.dart:396:17) E/flutter ( 7499): E/flutter ( 7499):

xSuperMu commented 3 years ago

Version: 4.1.2

await for (var page in Printing.raster(await _buildDocument(), dpi: printerDpi)) { final image = page.asImage(); printer.image(image); printer.cut(); } printer.disconnect();

Having this error.

E/flutter (14896): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: RangeError (index): Invalid value: Not in inclusive range 0..254096: 254097 E/flutter (14896): #0 List.[] (dart:core-patch/growable_array.dart:254:60) E/flutter (14896): #1 Generator._packBitsIntoBytes (package:esc_pos_utils/src/generator.dart:207:16) E/flutter (14896): #2 Generator._toRasterFormat (package:esc_pos_utils/src/generator.dart:193:12) E/flutter (14896): #3 Generator.imageRaster (package:esc_pos_utils/src/generator.dart:629:38) E/flutter (14896): #4 NetworkPrinter.imageRaster (package:esc_pos_printer/src/network_printer.dart:130:28) E/flutter (14896): #5 _MyHomePageState._print (package:thermal_printer_test/main.dart:190:15) E/flutter (14896):

assem16399 commented 1 year ago

@mjafartp @xSuperMu @sbrsubuvga Has anyone found any solutions?

xSuperMu commented 1 year ago

@assem16399 That was on a very old project of mine. Sorry I can't help you with that. Thanks.

TamirlanBir commented 10 months ago

@assem16399 Did u solve it ?