How print invoice receipt using bluetooth thermal printer
you can use this
void printLine(String txt, char type){
byte[] format = { 27, 33, 0 };
byte[] arrayOfByte1 = { 27, 33, 0 };
if (type == 'b') {
format[2] = ((byte) (0x8 | arrayOfByte1[2])); //BOLD
}
if (type == 'h') {
format[2] = ((byte) (0x10 | arrayOfByte1[2])); //HEIGHT
}
if (type == 'w') {
format[2] = ((byte) (0x20 | arrayOfByte1[2])); //WIDTH
}
if (type == 'u') {
format[2] = ((byte) (0x80 | arrayOfByte1[2])); //UNDERLINE
}
if (type == 's') {
format[2] = ((byte) (0x1 | arrayOfByte1[2])); //SMALL
}
mService.write(format);
mService.sendMessage(txt,"GBK");
}
credit goes to Leonardo Sapuy and his original q/a Format text in bluetooth printer and thanks to Murtaza Khursheed Hussain for sending me to it
I have found the following image over the internet for Text Alignment. Hope it helps