Coder Social home page Coder Social logo

Comments (10)

GoogleCodeExporter avatar GoogleCodeExporter commented on May 18, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 18, 2024
[deleted comment]

from python-escpos.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 18, 2024
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.

Davidamgad2 avatar Davidamgad2 commented on May 18, 2024

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.

belono avatar belono commented on May 18, 2024

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.

Davidamgad2 avatar Davidamgad2 commented on May 18, 2024

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. :")

snippts

from python-escpos.

Davidamgad2 avatar Davidamgad2 commented on May 18, 2024

I had to figure out a solution and used Arabic shaper and and Image method to solve this issue.

from python-escpos.

belono avatar belono commented on May 18, 2024

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.

Davidamgad2 avatar Davidamgad2 commented on May 18, 2024

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.

belono avatar belono commented on May 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.