react-native-thermal-receipt-printer-image-qr icon indicating copy to clipboard operation
react-native-thermal-receipt-printer-image-qr copied to clipboard

Support for changing printer codepage to support arabic?

Open Mohamed-kassim opened this issue 3 years ago • 8 comments

for now printer printing Arabic letters in a reverse way, any way to support changing the print code page while initializing or with connecting to print with different characters?

Mohamed-kassim avatar Dec 24 '21 00:12 Mohamed-kassim

You can screen shot your screen and using image or base 64 to print!

https://github.com/gre/react-native-view-shot

z3049044734253_87c62fa8efe632609f32cfa5bdf5704a

thiendangit avatar Dec 24 '21 01:12 thiendangit

@thiendangit this is a good workaround, yes but it will prevent using all good APIs provided by this package including print columns and others, you will need to implement full receipt with react native UI then print it as an image also, it gives a bad performance printing image instead of just text I know another package that is supporting changing codepage can u try to check its native code if u can clone it to yours? https://github.com/mrefaie/react-native-esc-pos-sahaab

EscPos.setCodePage(config?.codePage); it was having 2 issues, one for changing codepage and I think it's the easy part and the second was that the string was reversed, they solved it from the native side but I think I can push the string reversed from the js side

also, I found that ESC pos encoder can generate commands with codepage I will try it and give you feedback let result = encoder .codepage('windows1251') .text('Iñtërnâtiônàlizætiøn') .codepage('cp737') .text('ξεσκεπάζω την ψυχοφθόρα βδελυγμία') .encode()

Mohamed-kassim avatar Dec 25 '21 12:12 Mohamed-kassim

@Mohamed-kassim is it working ?

thiendangit avatar Dec 27 '21 03:12 thiendangit

@thiendangit I tested it more than once it's not working, but I think it's about printer mapping so I am trying again let me explain it briefly every printer have a list of codepages every codepage have value and page for every printer

the old package was taking the codepage index from the user as the user know what's the language he need to print with so he picks it from the printer configuration file -included image- then the package map it to the right hex code command >> and this is approach is very good for example I need to assign cp864 for old package I assign 22 from this image for encode I assign cp864 photo_2021-12-27_22-45-13

but esc pos encoder takes the value, not the index which maps for every printer differently u can check their source files for mappings so I think my printer mappings are different so it's not working I will try again with custom mapping to check if it's working

sorry for being late I will try to test It again as fast as possible

Mohamed-kassim avatar Dec 27 '21 20:12 Mohamed-kassim

@Mohamed-kassim many tks! i'll try in weekend!

thiendangit avatar Dec 28 '21 03:12 thiendangit

Are you able to solve it?

mufasilfaizal avatar Jan 11 '22 17:01 mufasilfaizal

any way to print Arabic letters ?

yaser-elbatal avatar Sep 06 '22 09:09 yaser-elbatal

any success?

MaheshKaemSolutions avatar Jan 24 '24 08:01 MaheshKaemSolutions