[TxMt] Printing in TextMate

Eric O'Brien ericob at possibilityengine.com
Sat Jul 8 05:36:50 UTC 2006


It seems to me (a non-programer even) that it is THIS sort of  
solution to a problem that gives me warm feelings about TextMate!!

The design approach results in a sense that "It's not just a text  
editor, it's an editing framework!"  Or something.  Although the  
functionality of enscript is not built-in to TextMate, it is fully  
AVAILABLE to TextMate.  I'm reminded of the fellow who "augmented"  
TextMate into being his favorite editor for writing Dramatic Scripts.  
(!)

"It's a breath mint!  It's a floor wax!  It's a chameleon!  It's  
fabulous!"  :)

There must easily be 20 or 30 other similar "case studies."

eo

On Jul 7, 2006, at 3:06 PM, Matthew Anderson wrote:

> If you make the following script a command (I called it "enscript  
> buffer"):
>
>   #!/bin/bash
>   # close stderr
>   exec 2<&-
>   # set options here
>   enscript_opt="-2Gr --line-numbers -o -"
>   tempfile="/tmp/texmate-print.$$.pdf"  # note: "$$" is the current  
> pid
>   pstopdf_opt="-i -o $tempfile"
>   # create the pdf and open it
>   enscript $enscript_opt | pstopdf $pstopdf_opt
>   open $tempfile
>   rm $tempfile
>
> input: Entire Document, output: Discard
>
> your default PDF viewer (probably Preview.app) will pop up with the  
> buffer's contents in two columns with line numbers and 'fancy'  
> headers.  You can then print from that pdf viewer.
>
> see "man enscript" for many potential options; the ones I used were:
>
>   -2			two columns
>   -G			fancy headers
>   -r 			landscape mode
>   --line-numbers	obvious
>   -o -			output to stdout
>
> It doesn't look like "mpage" is a standard tool installed on OS X;  
> if it was, you could do some additional interesting things with  
> arranging text (like more than 2 pages per page).  I bet you could  
> install it from somewhere and use it though, if you needed its  
> capabilities.
>
>
> On Jul 7, 2006, at 4:30 PM, Brad Choate wrote:
>
>> For two column, landscape layout, just choose the "Layout" set of  
>> options from TM's print dialog.
>>
>> For line numbering, you'll have to use the "Create HTML from  
>> Document" command (in the TextMate bundle) to produce a html  
>> representation of your source (there's even an option to display  
>> line numbers). Save the output to a .html file and open it in  
>> Safari. From there you can select page layout options from  
>> Safari's print dialog. It also preserves the theme you're using,  
>> so select a theme and font that is suitable for printing before  
>> using the "Create HTML..." command.
>>
>> -Brad
>>
>>
>> On Jul 7, 2006, at 1:34 PM, Kurt Wolf wrote:
>>
>>> I am wondering if there are settings that can be adjusted for  
>>> setting up printing support in TextMate.  I would like to print  
>>> line numbers and change the font to a more printer friendly  
>>> choice.  Also (dreaming here), being able to print landscape on  
>>> the page in a two col style would be killer.  Any thoughts?
>>>
>>> ____________________________________________________________________ 
>>> __
>
> --
>  Matt Anderson




More information about the textmate mailing list