I'm using a printer: EPSON TM-m30
I'm currently using :
esc_pos_printer: ^4.0.3
esc_pos_utils: ^1.0.0
When I run this code
printDemoReceipt(NetworkPrinter printer) async {
printer.text('ا ب ت ث ج ح خ د ذ ر ز س ش ص ض ف ق ك ل م ن ه و ي');
printer.feed(2);
printer.cut();
printer.disconnect();
}
It causes this error
[ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: Invalid argument (string): Contains invalid characters.: "ا ب ت ث ج ح خ د ذ ر ز س ش ص ض ف ق ك ل م ن ه و ي"
_UnicodeSubsetEncoder.convert (dart:convert/ascii.dart:88:9)
Did anyone fix this issue?
Thank you.
Actually I have the same issue and I believe for now the only solution is to create a PDF then covert it to an image and then you can print it.
Try to
import 'dart:convert' show utf8;
printDemoReceipt(NetworkPrinter printer) async {
final arabicText = utf8.encode('ا ب ت ث ج ح خ د ذ ر ز س ش ص ض ف ق ك ل م ن ه و ي');
printer.textEncoded(arabicText);
printer.feed(2);
printer.cut();
printer.disconnect();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With