Comments (2)
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.
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)
- Text size not working (width and height) HOT 11
- 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
- Tabbed text HOT 8
- 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.