Convert to PDF
So we got this ASP classic webapplication that generates reports and printable forms. Since that information must be available offline, a little COM module called ABCPDF installed on the server where you can just drop in an URL, and the module sorts it out, and out comes a PDF, all at the click of a button. Hurray.
Except the current feature request is for a permanent header/footer on each page, which the module doesn't do. It just pretends it's printing a web page and uses a print stylesheet. There's no way to specify things that must appear on every page — at least not when it's rendered from HTML.
Any thoughts on different PDF converters that can do this? Or creative alternative solutions?
The winner will receive a special gift in their signature. Or not.
The pages you are printing are standard letter size/shape correct? If the 'pages' you are printing are set to a specific size and you are generating what you feed to your converter then just adjusting your input to it may be the best way. I've dealt with some converters but most work in the print something manner and the few that aren't just set up like a fake printer tend to be $5000-$10000 for a license (they do tons of other things too), so I'd recommend just slapping it in the HTML. Of course if you need to handle things thrown at you by users then go for the fancy things, but make sure you can charge the client for the licenses.
It can lead to a convoluted solution but PDFtk ([url]http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/ [/url]) does something alike, look for the stamp and multistamp options.
Or creative alternative solutions?
Run the PhantomJS headless version of the Webkit browser and script it to output its loaded pages as PDF, using Jakarta. (See https://github.com/ariya/phantomjs/wiki/Screen-Capture) Then feel free to use all the goodness of print stylesheets and CSS @page directives to control repeatable headers & footers, widows and orphans, page margins, page orientation, left/right alternation, etc. as they become available. (Don't be surprised if many people don't know this is / will soon be possible. I informed one of my colleagues about this last week and the answer I got back was a momentary blank stare followed by: "WTF?! You can do that with CSS?" (Yes... you can... Very much so in fact...)
Ofcourse, until Webkit supports all of it : there is a stop gap solution.
(Note that if you can work out your own binding points, you could even let your pages call back to PhantomJS exactly at the time they are ready to print. This will give you very precise control and will prevent awkward fiddling with 'wait time' you regularly have to deal with 'until it is safe to print'...)
the answer I got
back was a momentary blank stare followed by: "WTF?! You can do that with CSS?"
I knew vaguely about CSS's possibilities, but, wow, you can do all that with Webkit?
From a first glance, it's going to take the better part of a week (which I don't have) to investigate all of this and prepare a robust solution (if possible), but you definitely get the Creativity Award.