[TxMt] Printing in TextMate

Matthew Anderson manders2k.lists at gmail.com
Fri Jul 7 22:06:03 UTC 2006


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?
>>
>> _____________________________________________________________________ 
>> _
>> For new threads USE THIS: textmate at lists.macromates.com
>> (threading gets destroyed and the universe will collapse if you  
>> don't)
>> http://lists.macromates.com/mailman/listinfo/textmate
>
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate

--
  Matt Anderson





More information about the textmate mailing list