Formatting Code for Printing in Xcode

If you have ever found yourself wanting to print out nicely formatted source code from an Xcode project, here are some very easy to follow directions from Richard Milewski for integrating the enscript utility. Note that although the article doesn’t mention it, you can use the same utility to write the formatted output to a postscript file should the urge ever arise.

Man, that’s a blast from the past. I don’t think I’ve used enscript since back in the NeXT days. I guess that’s because I never print code out anymore, but every once in a while a student in class will ask to print out some of the files they’re working on so they can stare at them back in their hotel room. Which is not a bad approach, because sometimes it can really help to scribble on pages of code, especially when you’re first learning Objective-C.


2 comments so far

  1. Richard Milewski on

    Any insight on the problem that there’s not a file that matches Xcode’s on-screen colors, or that the mac.enc file clearly dates from an earlier version of MacOS?

    Enscript dates from 1998 or 2003 depending on whether you install it with apt-get (fink) or use the MacPorts version.

    You’re the first person I’ve found who admits to knowing anything about enscript!

    • jonathanlehr on

      Well, I used to know something about it. We actually used it pretty frequently to take code to meetings and so forth back in the days when laptops were scarce. In the really early days, we used TextEdit in developer mode (which ceased to be a feature of TextEdit long ago), and there was no syntax highlighting. So the highlighting that enscript did was never tied to the forerunners of Xcode (essentially, TextEdit and ProjectBuilder, along with some Terminal integration for gdb).

      So it’s no surprise that the file doesn’t match Xcode, though I’d be willing to bet that someone, somewhere has one laying around.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: