andrey-ushakov / esc_pos_utils

Basic Flutter/Dart classes for ESC/POS printing
BSD 3-Clause "New" or "Revised" License
147 stars 329 forks source link

Is there anyway can I solve the images issues printing out on pos system via flutter? #90

Closed vivekebiit closed 2 years ago

vivekebiit commented 2 years ago

I'm not able to print out my images on receipt paper


final Uint8List imgBytes = data.buffer.asUint8List();
var image = decodeImage(imgBytes);
printer.image(image,align: PosAlign.center);```
GithubPranshul commented 1 year ago

hey, did you able to print the image? I'm also not able to print images can you share something? thanks

BrunoSantosCosta commented 1 year ago

were you able to print pictures?

GithubPranshul commented 1 year ago

were you able to print pictures?

Yes I did, but I used flutter blue and esc_pos_utills

jbrechbuehl commented 1 year ago

Hello, I can print images with the following code:

import 'package:image/image.dart' as img;
import 'package:esc_pos_printer/esc_pos_printer.dart';
import 'package:esc_pos_utils/esc_pos_utils.dart';
...
final NetworkPrinter manager = NetworkPrinter(paperSize, profile);

Future<void> image(Uint8List bytes, {align = PosAlign.center}) {
   final img.Image image = img.decodeImage(bytes)!;
   final img.Image resized = img.copyResize(image, width: 558);
   this.manager.image(resized, align: align);
}
Abdulazeezvp commented 1 year ago

In my opinion, https://github.com/kechankrisna/pos_printer_manager is preferable. Packge is dependent on this package, and for larger images, it is managed.

BrunoSantosCosta commented 1 year ago

thanks for the help guys, i got it here

waqadArshad commented 1 year ago

Thanks a lot. needed to add this line for resizing the image.

final img.Image resized = img.copyResize(image, width: 558);

the rest was the same as the package suggested.