Ok, have tried two toolkits with a little better success. But nothing that will actually work.
Both are just command line at the moment, they could later be built into a filter for CUPS (God knows exactly how i'll actually do that)
psutils (ps to ps, etc):
This one is messy, but almost works. pstops allows you to merge postscript pages in the same document onto one page. So:
- Merge header onto top of document (with ghostscript in pdf because doing it in postscript screws up, then convert back to postscript :s )
- Get pstops to merge page 0 onto page 1. Fine for the first page, but the pstops spec "2:0+1" (A short regex like language for instructing pstops what to do) I wrote means it will merge every other page together. Not only can I not get the header on anything but page 1, but it screws up pages 3-4, 4-5 etc.
Unless I blow the doc apart and stack a copy of the header inbetween each page, this wont work.
This seemed to work much better, except in terms of getting it back to Postscript for Cups to use. Got closer to being a filter.
- Convert incoming stdinput into PDF
- Pipe into pdftk with the following
pdftk - background testBanner.pdf output -
(The -'s are for using stdin and stdout, check man if you want files)
- Pipe out to pdf2ps to get back to Postscript for CUPS.
The resulting PDF is great at stage 2, but the resulting Postscript file at the end of stage 3 is buggered. The data is messed up and the pages are teenyly short.
So, help =/
With what is meant to be a paperless office how is printing a header via CUPS so hard?!