PrintWithColors

If you need to print source code and would like to do so with full syntax highlight then there is a way to do so.

In the TextMate bundle is a command named Create HTML From Document / Selection. By calling this command without a selection¹, a HTML version of your current document is created with CSS that has it styled similar to your current theme.

You can change the output of this command (via the Bundle Editor) to Show as HTML and then simply press ⌘P to bring up the Print dialog after calling the command, or alternatively you can save the HTML and print e.g. from Safari.

If you do this a lot, you can also assign a key equivalent to the command.


¹ With a selection, the command generates HTML for just the selection and leaves out the CSS, this is meant e.g. for inclusion in blog posts or similar.