-
-
Notifications
You must be signed in to change notification settings - Fork 181
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
+: Add new method for set character's size. #273
base: master
Are you sure you want to change the base?
Conversation
@@ -2,7 +2,8 @@ | |||
{ | |||
public static class Chars | |||
{ | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If new commands are introduced we need new Unit Tests, or at least include them in the Console Test Suite
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.