views:

259

answers:

6

I have occasion to need to print code (Horrors!!! ;) ), and i was wondering what editor or tool would i use to print that code out with proper formatting and syntax highlighting? If it's important, it will be c# code but ideally the tool will work for as many languages as possible. Can Notepad++ or something handle this?

+4  A: 

http://pygments.org/ is one option. It supports a ton of languages, and since it's written as a python library, you can script the conversion process however you want.

Amber
+1  A: 

You can use any colorizer which produces html and simply print the page

valya
+4  A: 

You can use vim! ":hardcopy" command will print with syntax highlighting on, and there's syntax highlighting definitions for many languages out there.

The default look is usually optimised for screen display, but you can fix that.

mahemoff
Don't use vim, sorry. Still a good answer though.
RCIX
+3  A: 

Yes, Notepad++ can certainly print code with syntax highlighting.

Colour printing would obviously be preferable, but on the occasions when I've printed in black and white, the subtle differences in colour [rendered as shades of grey, of course] can be difficult to distinguish.

However, I think a little customisation of the colour schemes should make this less of a problem.

pavium
+3  A: 

Visual Studio will, and allows you have a completely separate configuration for printing.

Richard
A: 

Under unix you might want to try a2ps. It is flexible and produces nice results.

ziggystar