-
-
Notifications
You must be signed in to change notification settings - Fork 182
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
Set print width #284
Comments
Which commands are you using to align text to center? |
e.CenterAlign() |
Then how do i solve it? Can i specify the number of characters in one line when justifying the text? |
But if you know your line is always gonna be 40 chars long, it is probably easier to build an internal method that pads empty space in order to center align your text. quick search in the internet, and found this for example static string center(string text)
{
int paperWidth = 40;
int stringWidth = text.Length;
int spaces = (paperWidth / 2) + (stringWidth / 2);
return text.PadLeft(spaces);
} You can check it out here: https://dotnetfiddle.net/E07KuV |
Hey,
i would like to set print width by limiting to 40 characters per line (using font B).
It work perfectly fine until I want to align to center - the printer just prints it thinking i'm using 80mm paper (i want to use 58mm instead) so the message is cut in half...
Any solutions?
Thanks x
The text was updated successfully, but these errors were encountered: