Python Color Printing
Fernando Perez
fperez528 at yahoo.com
Thu Jun 24 21:23:09 EDT 2004
Kamilche wrote:
> Peter Hickman <peter at semantico.com> wrote in message
> news:<40daabc1$0$10280$afc38c87 at news.easynet.co.uk>...
>
>> There is a GNU tool called source-highlight that handles python. It will
>> create a html file with the colour coding. You could then print the html
>> file.
>
> Thanks, I've got one of those. But then, how do I handle adding
> headers, footers, changing the window title to get rid of 'Microsoft
> Internet Explorer', and automatically printing? That's the part where
> it falls down on.
>
> If someone knew how to do that via Python, that'd work! :-)
Sometimes, simple, old tools can be very handy:
haar[~]> which codeps
codeps: aliased to enscript -G2rjE --color -o !*.ps !*; gv !*.ps
haar[~]> which codeprint
codeprint: aliased to enscript -G2rjE --color !*
This gives 2-up output, just remove the 2 option for single-page output.
enscript is a wonderful tool, I use this all the time to print code (and it
highlights many languages, not just python).
Cheers,
f
More information about the Python-list
mailing list