Indiana University
University Information Technology Services
  
What are archived documents?
Login>>
Login

Login is for authorized groups (e.g., UITS, OVPIT, and TCC) that need access to specialized Knowledge Base documents. Otherwise, simply use the Knowledge Base without logging in.

Close

ARCHIVED: What is enscript, and how can I use it to print text files in PostScript?

In Unix, the enscript command changes a text file to PostScript format and then sends it to the printer. The general format for enscript is:

enscript [switches] textfilename

Replace textfilename with the name of the file you want to convert and print. The [switches] are optional settings, as follows:

-h Suppress printing banner pages
-P (uppercase P) Specify a printer (BSD-compatible systems)
-d Specify a printer (System V systems)
-2 Print two columns per page
-r Rotate the output 90 degrees
-G Print "gaudy" headers, with large page numbers and filenames
-l (the letter l) Simulate a 66-line-per-page line printer
-p (lowercase p) Direct output to standard output or to a file

Note: You can combine the -2 and -r options to produce 2up style documents, with two pages per sheet in landscape orientation.

Examples

On a BSD-compatible system, to convert and print the text file myfile.txt to printer ps99 without a banner page, you would enter at the Unix prompt:

enscript -Pps99 -h myfile.txt

To make a PostScript file of the text file myfile.txt and save it as myfile.ps, you would enter:

enscript -pmyfile.ps myfile.txt

To redirect the output of enscript as input for another command, append another dash to the -p option, for example:

enscript -2rG -p- myfile.txt | psduplex | lpr -Pps99 -h

This will convert myfile.txt into a two-column, rotated PostScript file with a large header, send it through the psduplex filter to print on both sides of the paper, and finally print the result without a banner page to the printer named ps99.

For more information about enscript, read its man page by entering the following:

man enscript

At Indiana University, enscript is installed on Steel and Libra.

Note: On June 23, 2008, Steel will become read-only; you will be able to access your files there but not change them or add new files. Steel is replaced by IU's newest supercomputer, Quarry. For more, see ARCHIVED: About the Steel retirement.

This is document afyk in domain all.
Last modified on November 01, 2008.

Comments/Questions/Corrections

Use this form to offer suggestions, corrections, and additions to the Knowledge Base. We welcome your input!

If you are affiliated with Indiana University and would like assistance with a specific computing problem, please use the Ask a Consultant form, or contact your campus Support Center.

Contact Information

Note: We will reply to your comment at this address. If your message concerns a problem receiving email, please enter an alternate email address.