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

Text size not working (width and height) #592

Closed
PonnyTheLight opened this issue Nov 15, 2023 · 11 comments · Fixed by #644
Closed

Text size not working (width and height) #592

PonnyTheLight opened this issue Nov 15, 2023 · 11 comments · Fixed by #644
Assignees
Labels

Comments

@PonnyTheLight
Copy link

PonnyTheLight commented Nov 15, 2023

Bug description

I used python-escpos before and all the code working perfectly, but a few days ago, all sizes not work. I dont know why but the text align work, but then the width and height not work in the same line. Any one can help me?

Steps to reproduce

  • Install python-escpos 2.2.0 and then connect to the printer with Network().
  • Then use the printer has connusar and try the code below.
    if connusar:
            if productsinc.exists():
                connusar.set(width=2, height=2, align='center')
                connusar.text(f"--= NUEVO PEDIDO =--\n\n{mesa.name}\n\n")
                connusar.set(align=u'center', width=1, height=1)
                connusar.text(f"Pedido Por: {userm.username}\n")
                connusar.set(align=u'center', width=2, height=2)
                connusar.text("\n ----------------\n\n")
                for product in productsinc:
                    if product.bolas != 0:
                        connusar.set(align=u'left', height=2)
                        connusar.text(f"{product.num}x {product.name.upper()}\n")
                        if product.formato == "1":
                            connusar.text(f"  * EN TARRINA {product.bolas} BOLAS\n")
                        elif product.formato == "2":
                             connusar.text(f"  * EN COPA {product.bolas} BOLAS\n")
                        elif product.formato == "3":
                             connusar.text(f"  * EN CUCURUCHO {product.bolas} BOLAS\n")
                        for add in product.adds.all():
                            connusar.text(f"  + {add.name.upper()}\n")
                        for sabor in product.sabores.all():
                            connusar.text(f"  - {sabor.namei.upper()}\n")
                        connusar.text("\n")
                    else:
                        connusar.set(align=u'left', width=2, height=2)
                        connusar.text(f"{product.num}x {product.name.upper()}\n")
                        for sina in product.sins.all():
                            connusar.text(f"  - {sina.name.upper()}\n")
                        for add in product.adds.all():
                            connusar.text(f"  + {add.name.upper()}\n")
                        connusar.text("\n")
                connusar.set(align=u'center', width=2, height=2)
                connusar.text("\n\n ----------------")
                connusar.cut()`

All align variables, working, but all width and height variables not working..

Device info

Printer: I dont know sorry
OS: Windows 11

@patkan
Copy link
Member

patkan commented Nov 15, 2023

Hi @PonnyTheLight,
could you please provide the information requested in the issue template?
on which OS are you? From which to which python-escpos version did you change?

@PonnyTheLight
Copy link
Author

Hi @PonnyTheLight, could you please provide the information requested in the issue template? on which OS are you? From which to which python-escpos version did you change?

Hello @patkan
Im using Windows 11 and Network() to connect to the printer. I changed from 2.0.0 to 2.2.0, I've been looking at it and in principle in both versions it is the same, so it should work exactly the same and send that request to the printer well.

@PonnyTheLight
Copy link
Author

up

@Framelony
Copy link

up
I downgraded to 3.0a9 and it works

@patkan
Copy link
Member

patkan commented Dec 1, 2023

Great to hear, does it also work with v3.0?

@Framelony
Copy link

Great to hear, does it also work with v3.0?

nope, it is the 3.0 release that is broken

@patkan
Copy link
Member

patkan commented Dec 3, 2023

Great to hear, does it also work with v3.0?

nope, it is the 3.0 release that is broken

And in which way for which printer?

I have checked the diff between 3.0a9 and 3.0 and I cannot see that there should be any change for the size parameters of set? v3.0a9...v3.0. The only thing that has changed is the behavior whether default values for the unspecified parameters are transmitted, but that (based on the code above) should not affect the output. Some more input would be helpful please.

@Framelony
Copy link

Framelony commented Dec 3, 2023

Great to hear, does it also work with v3.0?

nope, it is the 3.0 release that is broken

And in which way for which printer?

I have checked the diff between 3.0a9 and 3.0 and I cannot see that there should be any change for the size parameters of set? v3.0a9...v3.0. The only thing that has changed is the behavior whether default values for the unspecified parameters are transmitted, but that (based on the code above) should not affect the output. Some more input would be helpful please.

POS80D ( AXON ) the problem is that no single height and single wide char works, left , custom , right center cut and lf works font is really really big just by sending a simple text with no formatting

tested on windows and linux fedora39 with python 3.12

@Framelony
Copy link

Framelony commented Jan 18, 2024

Tested with rev 3.1 and the problem is still there
the before and after in two picture:
IMG20240118132756.jpg
IMG20240118132759.jpg

same code sent to the printer

@gcervifi
Copy link

I had the same problem, 3.08a was working and 3.1 did not.
Set the parameter custom_size=True to enable a custom width and size in set function.

:param double_height: doubles the height of the text
:param double_width: doubles the width of the text
:param custom_size: uses custom size specified by width and height
parameters. Cannot be used with double_width or double_height.

@belono
Copy link
Contributor

belono commented May 24, 2024

Hi @gcervifi and thanks for the tip 😉

It seems like we should clarify in the documentation the requirement of custom_size=True when setting custom width and height.

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

Successfully merging a pull request may close this issue.

5 participants