I'm working on a project to automate the creation of shipping labels, (Avery 8127) to be exact. I get a PNG of the USPS/UPS/FedEx shipping label, but the packing slip can vary between a PDF or a screenshot of a webpage.
My initial (quasi successful) solution was to use ImageMagick to manipulate the USPS label, convert the packing slip to a PNG and again, use ImageMagick to append them together to create a single graphics file with both images laid out correctly.
However, this isn't ideal. I'd like the ability to generate a new document (whatever it may be, PDF, PS, image, etc.) where I layout the graphic where it needs to be and insert the text below it. I'd like to have the ability to change the font size or add/remove text as needed.
What tools are available for this type of thing? How can I create and lay out a new document programmatically based on a graphics file and a file containing text?
(Could I do this with a CUPS printer filter?)
I'm currently working on macOS, but I'm looking for something portable so I can easily move it to a FreeBSD server later.