+: Add new method for set character's size.#273
+: Add new method for set character's size.#273lionden wants to merge 1 commit intolukevp:masterfrom
Conversation
| { | ||
| public static readonly byte StyleMode = 0x21; | ||
| public static readonly byte StyleMode = 0x21;/**ASCII Char: !*/ | ||
| public static readonly byte SizeMode = StyleMode; |
There was a problem hiding this comment.
if they are always the same, I don't see why use a new one just for SizeMode, let's keep using the StyleMode char also for the Size command
| public virtual byte[] SetSize(byte widthMagnification, byte heightMagnification) | ||
| { | ||
| if (widthMagnification > 7) widthMagnification = 7; | ||
| if (heightMagnification > 7) heightMagnification = 7; |
There was a problem hiding this comment.
Can we actually have enums for the magnification parameters? I see 7 is the maximum, but what is the minimum acceptable value for magnification? Does magnification = 1 means it's a regular-sized print?
Perhaps we want to add some validation, like the ones that exist for Barcode commands, in order to prevent users to use out of range magnification values. What do you think?
| /// </summary> | ||
| /// <param name="magnification">Enlargement in both horizontal and vertical direction.</param> | ||
| /// <returns></returns> | ||
| public virtual byte[] SetSize(byte magnification) => SetSize(magnification, magnification); |
There was a problem hiding this comment.
If new commands are introduced we need new Unit Tests, or at least include them in the Console Test Suite
igorocampos
left a comment
There was a problem hiding this comment.
Hi @lionden
I provided a couple of comments, if you could address them I would be able to merge your PR.
Also, have you tested this in an EPSON printer? Can you provide some pictures of the end result? Thank you
Hi Luke,
Thanks for your great project for printing receipt with ESC/POS protocal via C#.
As a developer from China, I mainly print Chinese chars ( Here, I want to thank you again for specially pointing out how to set GBK encoding in the ramp up document). I need to set the chars in different size.
So as the title mentioned, I have add a new method to support set characters' size.
I try to keep the code style as yours, hope these codes can be accessed. ;-)
And I'm going to add another support for .NET MAUI application, print receipt with Android/iOS device via bluetooth. I'll keep update to you if done.
Thanks and BR,
Lionden L.