Back to Blog

How I Accidentally Built Printer Software

It was supposed to be a simple WebSocket app. It became a full-blown printer framework, a descent into madness, and a war crime against thermal paper.

4 min read

The Idea (aka The Lie I Told Myself)

So my family’s friend runs a restaurant and wanted online orders to auto-print.
My first thought: “Easy. I’ll just make a WebSocket server, connect with API tokens, have an Electron app listen for new orders, and print with that cheap little thermal thing. Done by lunch.”

Yeah. No.

Because what I actually ended up doing was:

  • accidentally making my own printer framework
  • realizing why everyone hates Electron
  • and discovering that the supposedly universal ESC/POS protocol every thermal printer supports…
    apparently skips this one specific model

And of course, I had to do all of this on Windows, because macOS decided that “printing things” was beneath it.
Yes — I literally installed a whole operating system just to make a printer shut up.
If that’s not commitment, I don’t know what is.


The Descent Into Printer Hell

It started simple.
The server worked. The Electron app connected. The orders came through.
Then I tried to print.

And the printer just— didn’t.

No errors, no warnings, just an LED looking at me like,

“Oh, you wanted me to print that? That’s cute.”

So, naturally, I did what every sane developer would do.
I threw ESC/POS commands at it like confetti, hoping one would stick.
It didn’t.
Not a single byte made it out alive.

Then it hit me: screw the raw commands. I’ll just print HTML.
Like it’s a ✨normal✨ printer.
Because apparently, that’s what this “thermal label printer” wanted.
So now my “fast, headless order printer system” literally spins up Chromium to render HTML receipts.
If that’s not dev irony, I don’t know what is.


The Settings Purgatory

I wish I could say it worked instantly.
Instead, I spent two full days tweaking driver settings, print margins, paper formats, and random Windows “Advanced Options” that might as well have been horoscopes.

At one point, it started printing correctly — just with a 10cm blank gap before every order.
No matter what I changed, it stayed. Like the printer was taking a deep breath before working.
I printed so many tests I could wallpaper a house with the wasted receipts 🧾
Easily 10 meters of thermal paper sacrificed to the gods of “just one more tweak.”


The Breakthrough

After dozens of restarts, driver reinstalls, and one small existential crisis,
it worked.
The printer spat out a perfect, formatted receipt — no delay, no gap, no curse.
I sat there in silence for a moment. It was beautiful ✨

And then the next print job came out with Comic Sans.


The “Framework”

At this point, I had built a full custom printer framework without realizing it.
The Electron app polls the API every 30 seconds (because screw WebSockets).
It can reprint past orders, group identical items like 6x Chicken Nuggets instead of six separate lines, and print with HTML templates rendered by EJS.
It even encrypts the connection, because why not — if I’m going to suffer, I’m going to do it securely.

Except here’s the thing no one tells you:
Electron itself can’t talk to printers. Or use WebSockets.
Yeah. ✨JavaScript✨. The language that runs the whole internet, but apparently not printers.

So I had to build a local backend server that starts up with the Electron app just so it could communicate with Windows and the printer.
Basically, my “desktop app” is now a full-stack microservice architecture that exists purely to print receipts.
And my dad still wonders why I spent a hundred bucks on coffee that month.

So yeah, what was supposed to be a “simple listener script” turned into an entire printing ecosystem that rivals whatever cursed software chain McDonald’s uses 🍟


Lessons Learned (and Ignored)

  • ESC/POS is fake news
  • Electron is both a blessing and a punishment
  • Polling works, always has, always will
  • Windows will sabotage you the moment you feel confident
  • There’s no such thing as “just a quick feature”
  • macOS is cute until you need it to actually do something
  • Coffee is cheaper than therapy, but not by much

Would I do it again? No.
Would I still brag about it? Absolutely.

Because at the end of the day, that stupid printer works.
It prints the right things, at the right time, and doesn’t crash.
And I’m still not entirely sure how ✨


TL;DR

It started as a WebSocket project.
It became a printer cult ritual involving Electron, HTML receipts, and 10 meters of wasted paper.
I installed Windows just to make it happen.
Now it even runs its own backend server because Electron refuses to cooperate.
It works now, and I have PTSD every time I hear a printer beep 🔊