HeligPfleigh / react-native-thermal-receipt-printer

A RN library for thermal printer
163 stars 103 forks source link

How do we issue cut command? #27

Closed harshmaur closed 3 years ago

r3hmaanMalik commented 3 years ago

Use this hex as cutter command. '\x1D\x56\x01'. Tested,

harshmaur commented 3 years ago

Thanks @r3hmaanMalik. Does that mean I can use hex to print other characters as well?

Also, where can I find the reference to the hex?

It would be great if you also give me an example to execute the command.

r3hmaanMalik commented 3 years ago

@harshmaur @HeligPfleigh

Im combining ecs/pos hex commands with this module to achieve this cutter or kick draw.

Here is my code snippet

var newLine = '\x0A'; var cmds = esc + '!' + '\x38' cmds += 'ABDUL'; //text to print cmds += newLine; //text to print

cmds += ''; //text to print
cmds += newLine; // NewLine 

cmds += esc + '!' + '\x00'; //Character font A selected (ESC ! 0)

// cmds += 'ABCDEFGHIKLMNOPQRSTVXYZABCDEFGHIKLMNOPQRSTVXYZ'; //text to print
cmds += 'COCA COLA';

cmds += cutter USBPrinter.printText(cmds);

you can use printBill or PrintText

harshmaur commented 3 years ago

Thanks a lot! @r3hmaanMalik

In the research I found this https://github.com/mosquito/python-escpos/blob/master/escpos/constants.py

r3hmaanMalik commented 3 years ago

yes we are also this as utility.