Ionic 5 bluetooth thermal mobile printer print formatted text

Anyone able to print formatted text in bluetooth mobile printer?
I mean a formatted receipt?
If anyone knows please reply with the string you printed. I need to center , bold and add few lines into printer. Below is the sample I used. ONLY “This is a test” printed.But not " It works".Any help?

var string = “\n\n This is a test \n\n It works \n\n”

var array = new Uint8Array(string.length);

for (var x = 0, l = string.length; x < l; x++) {

  array[x] = string.charCodeAt(x);


this.ble.writeWithoutResponse(device_id, service_uuid, characteristic_uuid, array.buffer);