Printing to cups using a post request

I have a Magicard printer connected to my balena fin via usb with cups, Im trying to see if there is a way to send a post request from my chromium instance with the PDF i want to print directly to the printer balenaFin VPN address? I want to try and remove the node process that I have that is controlling the print job due to RAM considerations

Hey Patrick,

Happy new year! :smiley:

To your question, I don’t really understand what you mean by “directly to the printer balenaFin VPN address”? Does this help at all:

Also, I have a new version of the browser block in the works. I’m not sure if it helps your use case much, but it adds an API so that everything can be dynamically controlled (URL displayed, GPU on/off, KIOSK on/off). If you’ve got any features that would help you, drop me an email ( and I’ll put them on the list. :wink:


Hi Phil

Happy new year to you too!

To clarify my question, I am looking for a way to send a post request/webhook from my backend server to the balena cups and trigger a print job. At the moment my POS is sending a print-job to the backend, which triggers a websocket on a node process on the balena, which sends a print job to CUPS. This has proven slow and unreliable so Im looking at simplifying the process

Thanks for the update on balena blocks browers, the new code looks great, Are you guys looking at a project with Firefox? I am having a lot of performance issues with chromium on my POS screens

Hey Patrick,

Sorry for the slow reply - too many plates spinning. :wink:

With regards to performance issues, do move over to the new version of the browser block. It is a much newer version of Chromium, so there should be general performance improvements in that regard. Also, it exposes the chrome remote debug port automatically, so you should be able to point your laptop browser to it and see what the performance bottlenecks are when your POS loads/operates.

Firefox: no plans at this point - but it is something that goes around my head periodically. However, the RPI foundation have put work into their version of Chromium to make it as performant as possible on a Pi, including getting the hardware video decoding to work - and they haven’t done anything for Firefox. So I would be surprised if Firefox ran better. Do you have any experience trying?

Printing: I’m going to have a chat to some colleagues and see if we can suggest anything. I have to admit that CUPS and printing in general isn’t my forte. But I’ll have a chat here and let you know of anything we come up with.


Hi there, with regards to CUPS, if you have a container configured with CUPS and a default printer set, then a command line version of sending a PDF to the printer is: lp example.pdf || lpr example.pdf.

If you wanted to implement a very lightweight HTTP=>LP|LPR interface and didn’t want the Node.js overhead, you could expand on wiring up something like this using netcat + systemd service (though in theory you could just have netcat running in a while true; do ... loop for a less reliable version, but one that does not require systemd.

Also, if the printer supports IPP, you could just send the job directly to it, without having CUPS do the spooling. Probably not for your use case though.

Thanks for this @ab77 & @phil-d-wilson

This is definatly going in the right direction. I am looking for a solution that is 100% reliable so I think webhooks + netcat is the way forward. In the article the author mentions it is not a secure solution when not on a local network(I am sending print jobs from AWS). Im wondering if exposing my public url port 80 as a webhook reciever will be secure. I will probably need to add some validation/authentication to the incoming requests

would this be the same as using a service like

Hey Patrick,

It would be recommended to add some authentication to your webhook requests, for sure.