JSPrintManager icon indicating copy to clipboard operation
JSPrintManager copied to clipboard

How does all this magic actually work? 🖍️

Open krtschmr opened this issue 1 year ago • 0 comments

Since i have zero background on this printing stuff but it's all fun to set this up for my wifes hair salon, i tried looking behind the doors a bit.

ESC/POS commands are quite nasty with all this bytecode, but glad we have this library.

eventually it becomes cpj.binaryPrinterCommands = escposCommands; where the commands are just a list of commands and that's about it.

when i played with the printer of my wife around, i realized i can GET/POST the IP address of it, and it'll print infos about the request. i realized, i can open just a socket to IP:9100 and send commands, so i tried to print hello world. this might have worked sometimes, but i still don't know how. definitely i wasn't able to send a cut command.

now using this library to build the escpos commands should be enough, at the end those are just commands in order.

how can i convert those commands now to actually then print on it via socket connection?

eventually in ruby i wanna do this

socket = TCPSocket.new "192.168.0.150", 9100
socket.write (bytecode)

and i'm failing to understand how this magic works

krtschmr avatar Nov 09 '23 11:11 krtschmr