'Node ESCPOS printer text alignments are not working for STAR printer

I am using ESCPOS library for printing menu items using SP700 star printer. Data is coming properly in print but align and style properties are not working.

My code snippet:

    var network = new escpos.Network(printerData.IpAddress);
    const options = { encoding: "GB18030" /* default */ }  // encoding is optional
    printer = new escpos.Printer(network, options);
        network.open(function (error, device) {
            printer
            .font('A')
            .align('ct')
            .style('NORMAL')
            .size(1, 1)
            ;
            
        printer.align('ct')
        printer.print("property- align: 'ct'");
        printer.align('CT')
        printer.print("property- align: 'CT'");
        printer.align('CENTER')
        printer.style('bu');
        printer.print("property- align: 'CENTER' & style: 'bu'");
        printer.style('B');
        printer.print("style: 'B'");
        printer.print("Date: ");
        printer.style('normal');
        printer.print("property- style: 'NORMAL'");
        printer.style('NORMAL');
        printer.println(printDataHolder.printData.date);
    });

Here I have added some dummy text to check with different property values like 'ct', 'CT', 'CENTER' for center alignment and 'bu', 'B' for bold style but all text are getting printed in left alignment and normal text.

Below is the print:

enter image description here

Any help on this will be appreciated. Thanks!



Solution 1:[1]

I overlooked your written printer model information.

Star Micronics' Dot Impact Printer has many unique ESC/POS commands, one of which is alignment settings.

ESC a n is for standard ESC/POS, but ESC GS a n for Star Micronics Dot Impact Printer.

EPSON
ESC a

[Name]
Select justification
[Format]
ASCII   ESC  a  n
Hex     1B  61  n
Decimal 27  97  n

Please refer to this specification and define your own bytes array data according to the command supported by the printer.
Dot Impact Printer STAR Command Specifications Rev. 1.91
Page 3-32

ESC GS a n
[Name] Specify position alignment
[Code] ASCII       ESC GS a  n
       Hexadecimal 1B  1D 61 n
       Decimal     27  29 97 n

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 kunif