LinuxDevCenter.com

oreilly.comSafari Books Online.Conferences.

We've expanded our Linux news coverage and improved our search! Search for all things Linux across O'Reilly!

Search
Search Tips

advertisement

Listen Print Subscribe to Linux Subscribe to Newsletters

Outputting Text
Pages: 1, 2, 3

Printing a poster or sign

Enscript is useful for making a quick-and-dirty sign from a text file. For example, suppose the text file "sign" contains the following text:



CAUTION

WET PAINT!

You can print a sign out of it by specifying a large font, such as Helvetica Bold at 72 points, and omitting the default headers:

$ enscript -B -f "Helvetica-Bold72" sign RET

Getting fancy with headers

You can customize the header text by quoting the text you want to use as an argument to the -b option. Use the special symbol "$%" to specify the current page. For example:

$ enscript -b "Page $% of the annual report" report.txt RET

Use the -G option to output text with graphic headers, with the header text set in blocks of various shades of grey. You can create your own custom fancy headers, too -- the way to do this is described in the CUSTOMIZATION section of the enscript man page.

Outputting in landscape mode

To output text in landscape mode -- where the entire text is rotated 90 degrees counterclockwise -- use the -r option.

To print the contents of the text file report.txt in landscape mode and with text set in 28-point Times Roman, type:

$ enscript -r -f "Times-Roman28" report.txt RET

Selecting the pages to output

To specify which pages are output, give the range of number(s) as arguments to the -a option. To print just the odd or even pages, use the special odd and even arguments. This is good for printing double-sided pages: first print the odd, and then feed the output pages back into the printer and print the even.

For example, to print the odd pages of the text file report.txt, type:

$ enscript -a odd report.txt RET

Then, to print the even, type:

$ enscript -a even report.txt RET

Language highlighting

Enscript recognizes the formatting of more than 40 languages and formats, from the Perl and C programming languages to HTML, and can highlight portions of the text based on its syntax; there's also one for email and news articles, called "mail", that highlights the message header lines. In Unix-speak, this is called "pretty-printing."

Give the name of the language or format with the -E option (be careful not to put a space between the E and the language name). For example, to pretty-print the HTML file index.html, type:

$ enscript -Ehtml index.html RET

To pretty-print an email saved to the file "important-mail", type:

$ enscript -Email important-mail RET

 

Pages: 1, 2, 3

Next Pagearrow




Tagged Articles

Be the first to post this article to del.icio.us

Sponsored Resources

  • Inside Lightroom
Advertisement

Sponsored by:

O'Reilly Media

©2009, O'Reilly Media, Inc.
(707) 827-7000 / (800) 998-9938
All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.
About O'Reilly
Academic Solutions
Authors
Contacts
Customer Service
Jobs
Newsletters
O'Reilly Labs
Press Room
Privacy Policy
RSS Feeds
Terms of Service
User Groups
Writing for O'Reilly
Content Archive
Business Technology
Computer Technology
Google
Microsoft
Mobile
Network
Operating System
Digital Photography
Programming
Software
Web
Web Design
More O'Reilly Sites
O'Reilly Radar
Ignite
Tools of Change for Publishing
Digital Media
Inside iPhone
O'Reilly FYI
makezine.com
craftzine.com
hackszine.com
perl.com
xml.com

Partner Sites
InsideRIA
java.net
O'Reilly Insights on Forbes.com