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

Receipt Styling #63

Open
shajeermhmmd opened this issue Jan 22, 2022 · 1 comment
Open

Receipt Styling #63

shajeermhmmd opened this issue Jan 22, 2022 · 1 comment

Comments

@shajeermhmmd
Copy link

The printer is connected and working with "Hello world!", Now I need to style the receipt,
How we can style the receipt with Company Logo, Barcode/QR code in ng-thermal-print?

@shajeermhmmd
Copy link
Author

Finally, I got the solution... I used the following print function, thanks for the wonderful plugin to connect with Printers,

print() {
var esc = '\x1B'; //ESC byte in hex notation
var newLine = '\x0A'; //LF byte in hex notation

var cmds = esc + "@"; //Initializes the printer (ESC @)
cmds += esc + '!' + '\x38'; //Emphasized + Double-height + Double-width mode selected (ESC ! (8 + 16 + 32)) 56 dec => 38 hex
cmds += 'BEST DEAL STORES'; //text to print
cmds += newLine + newLine;
cmds += esc + '!' + '\x00'; //Character font A selected (ESC ! 0)
cmds += 'COOKIES                   5.00'; 
cmds += newLine;
cmds += 'MILK 65 Fl oz             3.78';
cmds += newLine + newLine;
cmds += 'SUBTOTAL                  8.78';
cmds += newLine;
cmds += 'TAX 5%                    0.44';
cmds += newLine;
cmds += 'TOTAL                     9.22';
cmds += newLine;
cmds += 'CASH TEND                10.00';
cmds += newLine;
cmds += 'CASH DUE                  0.78';
cmds += newLine + newLine;
cmds += esc + '!' + '\x18'; //Emphasized + Double-height mode selected (ESC ! (16 + 8)) 24 dec => 18 hex
cmds += '# ITEMS SOLD 2';
cmds += esc + '!' + '\x00'; //Character font A selected (ESC ! 0)
cmds += newLine + newLine;
cmds += '11/03/13  19:53:17';

this.printService.init()     
    .setSize('normal')
    .writeLine(cmds)
    .feed(4)
    .cut('full')
    .flush();

}

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

No branches or pull requests

1 participant