Closed Martomate closed 3 years ago
Hi @Martomate ,
thanks to report this problem. I'm trying to reproduce the error on my printer (TM-T20) without success. can you help me?
I wrote this (working well, without bug)
public void bugLineSpacing(EscPos escpos) throws IOException {
Style style1 = new Style();
style1.setLineSpacing(100);
Style style2 = new Style(style1);
escpos.write(style1,"hello");
escpos.feed(style1,1);
escpos.writeLF(style1,"Line Spacing");
escpos.writeLF("-------");
escpos.write(style2,"hello2");
escpos.feed(style2,1);
escpos.writeLF(style2,"Line Spacing2");
escpos.writeLF("-------");
style2.setLineSpacing(1);
escpos.write(style2,"hello2");
escpos.feed(style2,1);
escpos.writeLF(style2,"Line Spacing2");
escpos.writeLF("-------");
escpos.feed(5).cut(EscPos.CutMode.FULL);
escpos.close();
}
Hello, that code works because you set the line spacing manually. I didn't do that in my code.
Hi @Martomate , If the solution above is good for you, it's all right for me too, otherwise, count on me to find another. ... regardless of this problem, the function feed() need some repair. Some printers doesn't recognize 'ESC d' and in the future(backlog) we need to work on this.
see you
Sure, that works. It is also possible to call escpos.resetLineSpacing()
, or to just change the style given by escpos.getStyle()
instead of creating a new one.
Now that you know of this bug you can fix it whenever it suits you. In the meantime these workarounds can be used.
Have a nice day!
When
new Style(style)
is useddefaultLineSpacing
is always set tofalse
. SincelineSpacing
starts out as 0 this results in no paper feeding.This is why: In the Style constructor we have:
But in the
setLineSpacing
method we have:This means that
defaultLineSpacing
will always be set tofalse
, and since the default value oflineSpacing
is 0 the paper will not feed.