-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
"5" character before line when .style('bu') #93
Comments
The issue of a "5" character being printed before every line when using the To fix this issue, you need to correct the _getStyle(boldOrString: boolean | StyleString, italic?: boolean, underline?: boolean | 0 | 1 | 2) {
if (typeof boldOrString === "string") {
switch (utils.upperCase(boldOrString)) {
case "B":
return this._getStyle(true, false, 0);
case "I":
return this._getStyle(false, true, 0);
case "U":
return this._getStyle(false, false, 1);
case "U2":
return this._getStyle(false, false, 2);
case "BI":
return this._getStyle(true, true, 0);
case "BIU":
return this._getStyle(true, true, 1);
case "BIU2":
return this._getStyle(true, true, 2);
case "BU":
return this._getStyle(true, false, 1);
case "BU2":
return this._getStyle(true, false, 2);
case "IU":
return this._getStyle(false, true, 1);
case "IU2":
return this._getStyle(false, true, 2);
case "NORMAL":
default:
return this._getStyle(false, false, 0);
}
} else {
let styled = `${
boldOrString ? _.TEXT_FORMAT.TXT_BOLD_ON : _.TEXT_FORMAT.TXT_BOLD_OFF
}${
italic ? _.TEXT_FORMAT.TXT_ITALIC_ON : _.TEXT_FORMAT.TXT_ITALIC_OFF
}`;
if (underline === 0 || underline === false) styled += _.TEXT_FORMAT.TXT_UNDERL_OFF;
else if (underline === 1 || underline === true) styled += _.TEXT_FORMAT.TXT_UNDERL_ON;
else if (underline === 2) styled += _.TEXT_FORMAT.TXT_UNDERL2_ON;
return styled;
}
} This change ensures that the correct ESC/POS commands are returned for the "BU" style, preventing the "5" character from being printed before every line. The output will be as expected:
If you need further assistance or have any other questions, feel free to ask!
|
Thank you! |
A character "5" is printed before every line when use .style('bu).
Ex:
printer
.font('A')
.size(0, 1)
.style("bu")
.tableCustom([
{ text: item.qtd.toFixed(1), align: "LEFT", width: 0.1 },
{ text: item.produto.toUpperCase().trim(), align: "LEFT", width: 0.9 },
]);`
PRINT: "51.0 PRODUCTNAME 1.00 1.00"
EXPECTED: "1.0 PRODUCTNAME 1.00 1.00"
The text was updated successfully, but these errors were encountered: