Comments (10)
Hello,
How did you managed to print arabic letters with python-escpos? I tried
everything but can't get it work. May I see your source code you are using to
print out? And it also might be useful for other to give response to your
question
Greetings,
Ozay
Original comment by [email protected]
on 24 Oct 2014 at 4:31
from python-escpos.
[deleted comment]
from python-escpos.
i used openerp's implementation.
https://github.com/t3dev/openerp-addons/tree/master/hw_escpos.
"def text(self,txt):" on hw_escpos/escpos/escpos.py is different. and this
fuction doing the trick to print arabic letters. i dont have printer to test
it more..:(
sorry for my bad english...
Original comment by [email protected]
on 25 Oct 2014 at 8:15
from python-escpos.
Greetings,
Does anyone figure out to print Arabic words? I have been search for a while now, and I couldn't find anything.
Thanks in advance!
Regards.
from python-escpos.
Hi @Davidamgad2 .
Are you setting the charcode to your printer?
There is a command that changes the charcode page of your printer, but your printer must support that charcode.
Hope this helps: #444
We are glad to help but, please, provide more info to let us help you better.
We need to know your system environment (SO, python version, python-escpos version, ...), your printer model and a snippet that reproduces the issue.
Thank you ;)
from python-escpos.
Hello @belono,
Thanks for your response! I appreciate your time.
I read the #444 and followed the solution there.
I have search for the codepage for Arabic and I found that it's CP720 from here
Weird thing that my printer I found the code page for from here
It says that it's
The issue here that when I try to print my sentence it doesn't give it to me.
This is the code I try
`# -- coding: utf-8 --
from escpos.printer import Usb
p = Usb(0x1FC9, 0x2016)
p.charcode('CP720')
p.text( "ازيك؟\n")
p.barcode('1324354657687', 'EAN13', 64, 2, '', '')
p.cut()
p.close()`
Device info:
OS: Windows 10 Pro
Python: 3.10.6
python-escpos version: I'm not sure but I follow the instruction that you gave for the prelease version(I think it's python_escpos-3.0a8)
My printer is
Xprinter XP-D200N
Thank you so much for your time helping me with this. I also apologize if there's any random info. I'm new to the thermal printer. :")
from python-escpos.
I had to figure out a solution and used Arabic shaper and and Image method to solve this issue.
from python-escpos.
Hi @Davidamgad2 .
When trying the following commands, I'm getting this output:
>>> from escpos.printer import Dummy
>>> dummy = printer.Dummy(profile="default")
>>> dummy.text("ازيك؟\n")
>>> print(dummy.output.decode('CP720'))
ازيك?
Is this output the one that is expected?
If so, try to add the param profile="default"
to the Usb connector, then
from escpos.printer import Usb
p = Usb(0x1FC9, 0x2016, profile="default")
p.text("ازيك؟\n")
p.close()
Are the correct characters printed now?
from python-escpos.
Hello @belono
Thanks for your reply!
I have tried your solution but the same happened it didn't give me the characters I want. It gave me the one in pic I previously uploaded.
Further more I tried
`>>> from escpos.printer import Dummy
dummy = printer.Dummy(profile="default")
dummy.text("ازيك؟\n")
print(dummy.output.decode('CP720'))
ازيك?`
It didn't give me the same output as it gave you. Have you installed any further packages?
Regards.
from python-escpos.
It didn't give me the same output as it gave you. Have you installed any further packages?
No, I haven't. I'm testing on a fresh installation in a pyenv virtualenv.
What about this:
from escpos.printer import Dummy
dummy = Dummy()
dummy.charcode("CP720")
dummy.text("ازيك؟\n")
print(dummy.output.decode("CP720"))
Are you getting the right output now? If so, try sending the dummy output to your printer:
p = Usb(0x1FC9, 0x2016)
p._raw(dummy.output)
p.close()
If the first worked, but didn`t the second, the problem may be in your printer's codepage.
What happens if you set the profile now?
p = Usb(0x1FC9, 0x2016, profile="default")
p._raw(dummy.output)
p.close()
from python-escpos.
Related Issues (20)
- Text size not working (width and height) HOT 9
- Image printing prints only garbage HOT 29
- Barcode not printed HOT 4
- Introduce IntEnum or similar for printer states
- Usb printer not working on web Application HOT 2
- Printer not found on web application HOT 1
- Font switching not working. HOT 3
- is_online() fails with raise NotImplementedError()
- Full cut not working on Epson TM-T20III HOT 2
- 'usb timeout error' when used on a raspberry pi 3 with a cheap POS-58 thermal printer HOT 5
- ImportError: cannot import name 'DeviceNotFoundError' from 'escpos.exceptions' HOT 2
- usb.core.USBError: [Errno 5] Input/Output Error` HOT 1
- EPSON TM-m30III randomly fails to print images HOT 1
- Arabic Text not printing correctly HOT 2
- Tabbed text HOT 6
- windows Invalid endpoint address HOT 1
- Printer Emulator Connection Issue HOT 6
- How to print big5 charcode HOT 1
- CLI not working for CupsPrinter, LP and Win32Raw connectors
- Print to a bluetooth device via rfcomm and printer.File() HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-escpos.