Monday, November 16, 2009

Firefox can't print, and what to do about it.

Say you've got a big, information-rich, scroll-heavy page, with annotations and doodads located a long scroll off the screen. But say it works: you can scroll around and find what you need; it's a solid app.

Firefox won't be able to print it -- not usefully, at least, b/c Firefox will print only to the right edge of the visible page, thereby limiting you to the width of your physical screen. Creating a new paper-type, some monstrously wide fictional ur-sheet, won't help things either. So what's a boy to do?

Enter CutyCapt, a WebKit-based command-line tool that renders to PNG. (Or PDF, or whatever file format your heart desires.) Better still, it will execute any Javascript on the page, so pages that are essentially blank until the JS runs will render just file.

You'll need Xvfb, the X virtual framebuffer, if you want to run it on a headless box, but Xvfb is a little miracle in itself.

No comments: