andrey-ushakov / esc_pos_utils

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

Arabic Text Print #89

Open Ashish-Raturi opened 1 year ago

Ashish-Raturi commented 1 year ago

Hi, thanks for the plugin

I'm trying to print Arabic text, but it's working. I tried to convert the Arabic text to an image (using the widget screenshot plugin), but it's not readable.

You can tell a proper way to deal with this issue.

maxzod commented 1 year ago

covert it to image then print the image is the best workaround for now

marwenbk commented 1 year ago

the proper way is to support UTF-8 encoding which is not supported by this plugin

imwa5i7 commented 1 year ago

is this issue fixed? if there is anything to make it work?? would appreciate your help

imwa5i7 commented 1 year ago

Hey Arshad, thanks for the heads up. I edited the capabilites.json file and added my printer with its code table for Arabic but the result is not good. It prints all the characters separately. You can see my code and please let me know if I am doing anything wrong here.

final profile = await CapabilityProfile.load(name: 'BT-600M');

  String arabicExample =
  'وعند موافقه العميل المبدئيه على التصميم يتم ازالة هذا النص من التصميم ويتم وضع النصوص النهائية المطلوبة للتصميم ويقول البعض ان وضع النصوص التجريبية بالتصميم قد تشغل المشاهد عن وضع الكثير من الملاحظات او الانتقادات للتصميم الاساسي.';

Uint8List byteList = await CharsetConverter.encode('windows-1256', arabicExample);

bytes += ticket.textEncoded( byteList, styles: const PosStyles(codeTable: 'WPC1256', align: PosAlign.right), );

waqadArshad commented 1 year ago

Hi @imwa5i7 , can you show me the output?