<< IDEA Educational License, $99 | Home | Thread Synchronization Puzzle >>

Enscript, Cygwin, Lpr, ...

I posted an elaborate script for pretty-printing code listings 19 days ago:

On Linux systems, enscript is hooked up directly to the default printer, so a simple command like:

[weiqi@gao] $ enscript Foo.java

will do.

On Windows, I use Cygwin to accomplish what I want. Things are not as automatic as on Linux, ...

I have learned since then that, in Cygwin too, enscript is properly hooked up to the default printer, just like on Linux. So I have thrown away that script, and use the enscript command directly.

Tags :


Re: Enscript, Cygwin, Lpr, ...

I've tried to print some perl from enscript on cygwin, but it spit ASCII for that postscript instead, butchering a small forest. How do you teach it to print the actual postscript?

Re: Enscript, Cygwin, Lpr, ...

At the moment, Cygwin's lpt doesn't work for me. So I have to resort to using Adobe Reader:

#!/bin/bash
#
# print-code
#
# Generate a filename based on the current date/time
FILENAME=`date +%Y%m%d%H%M`
#
# Generate PostScript
enscript "$@" -o $FILENAME.ps
#
# Generate PDF
ps2pdf $FILENAME.ps
#
# Print PDF with Adobe Reader
c:/Program\ Files/Adobe/Acrobat\ 7.0/Reader/AcroRd32.exe /p $FILENAME.pdf
#
# Remove temporary files
\rm $FILENAME.ps $FILENAME.pdf

Re: Enscript, Cygwin, Lpr, ...

Thanks for posting the little snippet for "printing to PDF". This works pretty nicely for me!

Add a comment Send a TrackBack