You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a follow-up to issue #15, as it seems the problem wasn't fully resolved before the issue was closed . The alignment for elements below the image on the Everycom printer (EC 400) is not working in newer versions of the library (>=3.0.0).
It seems that recent refactoring related to alignment seems to have introduced this issue. The .align() method is not working for elements below image, but using a raw alignment command works, indicating that the printer itself is functioning properly.
Here are the test cases I have tried:
Case 1 :
encoder.raw([ 0x1B, 0x61, 0x02 ]);
encoder.line('Text with right alignment 1');
encoder.image(img, 400, 400);
encoder.raw([ 0x1B, 0x61, 0x00 ]);
encoder.line('Text with left alignment 2');
Case 2 :
encoder.align('right');
encoder.line('Text with right alignment 1');
encoder.image(img, 400, 400);
encoder.align('left');
encoder.line('Text with left alignment 2');
Case 3 :
encoder.align('right');
encoder.line('Text with right alignment 1');
encoder.image(img, 400, 400);
encoder.raw([ 0x1B, 0x61, 0x00 ]);
encoder.align('left');
encoder.line('Text with left alignment 2');
Case 4 :
encoder.align('right');
encoder.line('Text with right alignment 1');
encoder.image(img, 400, 400);
encoder.raw([ 0x1B, 0x61, 0x00 ]);
encoder.align('center');
encoder.line('Text with center alignment 2');
Case 5 :
encoder.align('right');
encoder.line('Text with right alignment 1');
encoder.image(img, 400, 400);
encoder.raw([ 0x1B, 0x61, 0x01 ]);
encoder.align('center');
encoder.line('Text with center alignment 2');
Please let me know if you need more details or examples. Thank you!
The text was updated successfully, but these errors were encountered:
The change in the way alignment works is very deliberate, as the default way printers deal with alignment causes issues. It also does not work with tables, boxes and in certain other situations with text wrapping. That is why the library now uses spaces to indent text. That should work reliable.
The issue you are seeing is not due to the new way of handling alignment. It even looks like it is due to the old way of handling alignment. Because images are still aligned in the old way.
Your printer apparently does not process the align command before an image. That is why your image is left aligned when it should be right aligned.
In the image below you can see the first line of text being aligned using spaces. Then for the image it sends an align=right command. Then the image data. And finally an align=left command. These commands are identical as the raw commands your are sending in your example.
Somehow it instead applies that align command when it reaches the next line - after the image data - which is a text line. And the align command after the image is ignored altogether, making the text right aligned. This absolutely is a printer issue.
This is a follow-up to issue #15, as it seems the problem wasn't fully resolved before the issue was closed . The alignment for elements below the image on the Everycom printer (EC 400) is not working in newer versions of the library (>=3.0.0).
It seems that recent refactoring related to alignment seems to have introduced this issue. The
.align()
method is not working for elements below image, but using a raw alignment command works, indicating that the printer itself is functioning properly.Here are the test cases I have tried:
Case 1 :
Case 2 :
Case 3 :
Case 4 :
Case 5 :
Please let me know if you need more details or examples. Thank you!
The text was updated successfully, but these errors were encountered: