Post

And this is what I've been spending my evenings on lately. A decoder for receipt printer protocols. You can take the bytes that get send to a receipt printer and inspect the commands that are inside of it. And... actually see a render of the receipt. Only useful for a hand full of people. And me.

But let's rewind. You start with some JavaScript and my ReceiptPrinterEncoder library to create the actual receipt. From JavaScript, in the browser or a server. Or using Capacitor or Electron. I've build integrations for everything. point-of-sale.dev

From the moment I've been working on this - 15 years ago - I've always wanted to build a decoder, so that I could inspect what we actually send to the printer... every single command that it receives.

But... what I really wanted is a renderer. For two reasons - some printers only support bitmaps, and I wanted to be able to print on those too. But I also wanted to have a preview to see how a receipt rendered.

And to render receipts, you need a bitmap font at specific sizes. And there wasn't yet one... So I created a bitmap font editor... I know 🤪

The result is a renderer that exactly matches a real printer. And it does not just support the code my own projects generate…

I generated receipts using a dozen different open-source encoders and test suites of other rendered and compared them manually with the output of dozens of printers. Painstakingly making sure to capture every single quirk and detail...

And it is now the best ESC/POS and StarPRNT renderer there is. Probably even better than some printers. But it will probably be used by just me. Or at most a handful of people. And that is fine. I love this project.

0 reposts0 likes

No replies yet.