This let's you group multiple commands and add attributes to them.
You can think of it as a div in html.
batch []
[ writeLine "Hello!"
, batch [ bold ] [ writeLine "I am bold!" ]
]Write the given string and insert a newline.
Do nothing.
Write the given text.
Insert a newline.
Prepare to print.
You should always include this as your first command for a ticket.
Cut the paper.
Return the command as bytes.
This is probably what you need to send to the printer.
Return the command as a list of ints, one for each byte.
This is useful to send through a port.
Return the command as json. It will be an array of numbers, one for each byte.
This is useful to send through a port.
Return the command as a base64 encoded string.
This function lets you implement your own custom command. This is useful if you want to add a command not included in this library.
For example, the initialize command is defined as:
{-
ASCII : ESC @
HEX : 1B 40
DECIMAL : 27 64
-}So you could implement using hex it by writing:
raw [ 0x1B, 0x40 ]or using decimal:
raw [ 27, 64 ]Note: For a list of ESCPOS commands you should check your printer documentation.
The basic building block.