kechankrisna / pos_printer_manager

GNU General Public License v3.0
13 stars 53 forks source link

arabic is not supported #20

Open Rabeeh96 opened 2 years ago

Rabeeh96 commented 2 years ago

E/flutter (16225): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: Invalid argument (string): Contains invalid characters.: "السلام عليكم ورحمة الله وبركاته" E/flutter (16225): #0 _UnicodeSubsetEncoder.convert (dart:convert/ascii.dart:85:9) E/flutter (16225): #1 Latin1Codec.encode (dart:convert/latin1.dart:40:46) E/flutter (16225): #2 Generator._encode (package:esc_pos_utils_plus/src/generator.dart:78:21) E/flutter (16225): #3 Generator.text (package:esc_pos_utils_plus/src/generator.dart:355:9) E/flutter (16225): #4 ESCPrinterService.getBytes (package:bluetooth_test/MasterBluetooth/service.dart:68:24) E/flutter (16225): E/flutter (16225): #5 _InvoicePrintScreenState._startPrinter (package:bluetooth_test/MasterBluetooth/bluetoothPrint.dart:248:16) E/flutter (16225): E/flutter (16225):

iyashiyas commented 2 years ago

i have tried below codes .. but still not get anyting.. printing wrong characters.. any one have solutions ?

List byte = []; // String reversString = reverseString(string); final Generator ticket = Generator(paper, profile); // ticket.setGlobalCodeTable('TP806L'); Uint8List encSeller = await CharsetConverter.encode('ISO-8859-6', string);

      byte += ticket.textEncoded(encSeller,
          styles: const PosStyles(
              height: PosTextSize.size1,
              width: PosTextSize.size1,
              align: PosAlign.center,
              codeTable: 'CP864'));

      printer.rawBytes(byte);
arbile26 commented 2 years ago

I suggest to you writing everything to in HTML then converting the content to image bytes using webcontent_converter package then print the bytes. I have done this, and it works perfectly with Arabic.