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

+: Add new method for set character's size. #273

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lionden
Copy link

@lionden lionden commented May 14, 2024

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.

@@ -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;
Copy link
Collaborator

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

Comment on lines +22 to +25
public virtual byte[] SetSize(byte widthMagnification, byte heightMagnification)
{
if (widthMagnification > 7) widthMagnification = 7;
if (heightMagnification > 7) heightMagnification = 7;
Copy link
Collaborator

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);
Copy link
Collaborator

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

Copy link
Collaborator

@igorocampos igorocampos left a 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

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

Successfully merging this pull request may close these issues.

2 participants