Coder Social home page Coder Social logo

Comments (2)

belono avatar belono commented on June 9, 2024

Hi @BaselAbdallah and welcome to python-escpos!

You can add the profile=’TM-T20II’ parameter to the printer's instance. It will instruct python-escpos which charcode sets are supported by your printer and encode your text string properly.
You can then force your printer to select an specific charcode set, but keep in mind that your printer must support that charcode set.

from escpos import printer
x = printer.Network("192.168.192.168", profile=TM-T20II’)
# x.charcode(code="CP864")
x.charcode(code="CP720")  # Correct
text = "عصير"
x.textln(text)
x.cut()

Does this work for your printer?

EDIT on 11-May: The correct charcode seems to be "CP720"

from python-escpos.

belono avatar belono commented on June 9, 2024

Hi @BaselAbdallah !

I had some time to take a second look at your issue.

It looks like "CP720" is the correct charcode and it is also supported by your printer. You only have to pass the profile="TM-T20II" parameter when instancing the connector and let the magicencode feature auto-detect the string encoding.
It works with the Dummy connector so it should do with the other connectors.

In response to the alignment of the text, python-escpos defaults to left aligned text. Did you try to set the printer to right align the characters?

from escpos import printer

x = printer.Network("192.168.192.168", profile=TM-T20II’)
x.charcode(code="CP720")  # Surely you can omit this command
x.set(align="right")
text = "عصير"
x.textln(text)
x.cut()
x.close()

Please, let us know if this works as many users would find this information useful.

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.