Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm looking through some of Wordpress' core code and would like to print it out to review.

I'm looking for a tool that

  • defaults to a monospace font
  • can wrap long lines
  • possibly print line numbers in the left column
  • maximize space usage on a page (i.e. would be nice if it didn't start with 2" margins)

What I've tried already:

  • Textmate: Unable to change screen and print font size independently. I don't want to have to switch back and forth
  • TextEdit: Options don't seem very helpful
  • MS Word: Have to paste the input, change line spacing and font. Painful.
  • Coda: Has the most options. Closest to what I want so far. Does not seem to save my print preferences as defaults though.
share|improve this question
1  
Syntax highlighting (i.e. color) if a known programming language? –  Daniel Beck Nov 30 '11 at 6:45
    
You might want to try to use the compiler that you usually use. Visual studio does a good job, I imagine your compiler (one of them maybe) might do the same. –  soandos Nov 30 '11 at 6:54
add comment

1 Answer

up vote 4 down vote accepted

I would use enscript --line-numbers -f fontname --word-wrap --margins=… filename

On my Linux systems enscript filename, by default, prints the file to my default printer (which understands Postscript - I don't buy any other sort).

In OS X, you can print to a PDF file using pstopdf:

enscript --line-numbers -p - --word-wrap Session.java | pstopdf -i -o ~/out.pdf

You can tweak global or personal settings for enscript to make those options standard so you just enter a command enscript filename. You may be able to set up an option in your favourite text editor that invokes external command enscript for you.

share|improve this answer
    
See here for an OS X workflow with enscript. Hope you don't mind the edit. –  slhck Nov 30 '11 at 11:50
    
The above links no longer work, but here's on that does qosys.info/642/printing-source-code-mac-os –  Noah Apr 18 at 0:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.