Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arabic language not support?? #21

Open
Alii-isk opened this issue Jan 27, 2024 · 3 comments
Open

Arabic language not support?? #21

Alii-isk opened this issue Jan 27, 2024 · 3 comments

Comments

@Alii-isk
Copy link

I tried to print something in Arabic but it got printed as random mixed chars

@Alii-isk
Copy link
Author

@justinmichaelvieira can u please help me

@justinmichaelvieira
Copy link

justinmichaelvieira commented Jan 27, 2024

@justinmichaelvieira can u please help me

You should try making a bitmap and printing that with PrintImage. This stackoverflow will guide you: https://stackoverflow.com/a/70022062/106625

Arabic characters are not directly supported by this library, so I can't offer more help, and it would take some time to implement. However using PrintImage should work fine for your case. You will just need to do the same as the java code I linked, in golang.

If you get it to work well, I would suggest offering a pull request, yourself.

@justinmichaelvieira
Copy link

justinmichaelvieira commented Jan 27, 2024

@Alii-isk take a look at https://github.com/hqbobo/text2pic as it may help you with creating the necessary image.

To summarize concisely, you want to:

  • Make an image.Image with desired arabic text (let's call it arabicTextImage)
  • Pass your created arabicTextImage to Escpos.PrintImage

    escpos/main.go

    Line 385 in 475ba14

    func (e *Escpos) PrintImage(image image.Image) (int, error) {

Technical note: Because the escpos printer language communicates with the ascii character set for text, printing an image is the best we can do if we want it to work on all escpos label printers. Some printers do support changing between "international code tables", which changes the "character set" of the printer, itself (see https://stackoverflow.com/a/63548498/106625 if interested in that). If you need it to print "fast", that may be the better option for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants