Hey everyone!
I wanted to share a solution I’ve come up with that might be helpful to some of you. I needed a way to generate PDFs programmatically, but I didn’t want to do it client-side since I wanted to trigger the creation from a mobile app.
Here’s how it works:
I built an app that serves as a PDF template, which needs to be publicly accessible so I can reach it via a headless browser. I then set up a queuing system to look for PDF jobs, create them, and send them off to printers through PrintNode.
The headless browser loads the template and takes a screenshot, with a specific area defined using a container with a border of a particular color. I use this color to crop the image and generate the PDF from that.
I've applied the same approach for labels using a list view with a fixed height—it generates a PDF, and then I convert each page to ZPL to send to a Zebra printer, again via PrintNode.
It's a super flexible system that’s been running really smoothly!
On the backend, I’ve used Python, Selenium, and a few other helpful Python libraries.
Feel free to reach out if you have any questions.
Cheers!