-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to print arabic #26
Comments
I've done a quick test and it appear that the data I get back from iconv-lite, which does the code page translation, already contain the question marks. So it is not an issue with the printer or EscPosEncoder itself. I'm not exactly sure why that is happening, except that the unicode code points in the string "جريدة" are not in the translation table. Perhaps the strings needs to be normalised or something. I'll follow up once I have more information. |
Thank you. Its is working fine. Actually codepage i wrong what i gave.. Now its printing but it is printing arabic from left to right. I want to print from right to left. Please help |
The problem with ESC/POS printers is that they are pretty dumb. You can basically print the arabic characters that the codepage provides and that is it. Things like right-to-left support and glyph shaping is simply not supported. My advice for proper arabic printing is to create a bitmap, draw a text string and print that. |
Can you please give me any example.. please |
Just got an Epson TM-T88VI which is the latest T88 model at the time of writing this and there are some Arabic settings using a special Epson utility. Here's some more information: qzind/tray#339 (comment) We're using a 3rd party library -- ICU -- that can get the UTF-8 glyph shaping and simplify it to IBM864. It's written in Java and C++: http://site.icu-project.org/#TOC-What-is-ICU- |
Yes, I am aware of ICU and that would indeed work. However I am not aware of a Javascript implementation of ICU, apart from an enscriptem compiled C version. But that has a pretty high footprint to include with the library. Mapbox actually uses Enscriptem compiled subset of ICU for pretty much the same purpose, rendering Arabic script on a WebGL map: https://github.com/mapbox/mapbox-gl-rtl-text |
Hi @vinothmoorthkumar How did you manage to print Arabic text? |
Chiming in, if you have the IBM-864 characters (NOT the UTF-8) characters and a printer that supports IBM-864, this should work. As noted above, the bytes may need to be swapped. Since 99% of websites are UTF-8, this makes Arabic very difficult natively (hence the conversation about about the ICU translation). Feel free to email me directly for more info about how I solved this problem. I believe most programmers give up with Arabic and send a raster image or PDF instead. |
@tresf Could you send me an example, please |
@tresf This is my case encodeWords(word){ |
@williamrizqallah out of respect of this project, I'm not going to cross-reference my solution, it's in Java and for a commercial product. My email address is in my GitHub profile if interested. |
@williamrizqallah I m using https://www.npmjs.com/package/canvas Canvas. I m creating canvas image and printing using https://www.npmjs.com/package/escpos |
@vinothmoorthkumar Thanks for your response Could you please show me an example |
Did you manage to solve this problem? |
Here is my code `const { canvas= createCanvas(580, 700) device.open(function () { |
Just modified @vinothmoorthkumar code little bit to work with printer and node-thermal-printer: const importedThermalPrinter = require('node-thermal-printer').printer;
const thermalPrinterTypes = require('node-thermal-printer').types;
const printer = require('printer');
const fetchedPrinter = printer.getPrinter('POS-80');
const createCanvas = require('canvas');
canvas = createCanvas(580, 700)
var ctx = canvas.getContext("2d");
ctx.textAlign = "left";
ctx.font = "30px bold";
ctx.fillText(' مرحبا بالعالم', 50, 50);
const thermalPrinter = new importedThermalPrinter({
type: thermalPrinterTypes.EPSON,
})
thermalPrinter.printImageBuffer(canvas.toBuffer()).then((s) => {
printer.printDirect({
data: thermalPrinter.getBuffer(),
printer: fetchedPrinter.name,
type: "RAW",
success: function (job_id) {
console.log('OK :' + job_id);
},
error: function (err) {
console.error(err);
}
});
}, (e) => {
console.error(e);
});
|
u can use .codepage('iso88596') |
hello my printer is print ?????? when use .codepage('iso88596') |
use encoding: 'Arabic', codepage: 22, |
@Waheed-Rumaneh |
yes i researched about it and it's worked for some printer the best way i used and it's worked prefect :
|
i am working with android device |
@amalnafia |
does this works,which converter are you using |
u can use this you can check this this repo use 3 laiblary secreenshot to convert widget to image https://github.com/blackangiliq/flutter_pos_printer_spport_arabic |
you need to convert text to bitmap image .. if image too height then after convert to bitmap split image to chunk |
how can you print arabic ? |
How you solve it to be able print Arabic ? |
@yaser-elbatal thanks |
with EscPosEncoder or Canvas ? |
I fix this problem by ...... |
@yaser-elbatal sure : |
use this lib to build bitmap from text :
|
Its printing ????. I can able to print chines...But arabic is not printing Please help
encoder
.codepage('cp864')
.text('جريدة')
.newline()
.cut('partial')
.encode()
The text was updated successfully, but these errors were encountered: