CMPSC 311, General Instructions

Using the Printer in 218 IST

The printer in 218 IST is named lj218 (lj = HP LaserJet).  If it isn't working, you can use the printer in 220 IST, which is lj220.  If the toner is low, or there's no paper, or there are other problems that need attention, send mail to .

Print requests go into a queue.  You can see the queue with the lpq command, and remove one of your own print requests with the lprm command.  You can see the status of the printer with lpstat.   (lp = line printer, an ancient technology)

lpq -P lj218
lpstat -p lj218

Note that lpq uses uppercase -P, while lpstat uses lowercase -p.  Most commands designating a printer use uppercase -P.

The commands lp and lpr are used to submit print requests, but usually you want some kind of formatting to be done first.

The big blue trash barrel is for paper recycling, the smaller gray trash barrel is for other stuff.

To print from Firefox,
Note that the Properties / Print Command is sticky - if you are in another CSE lab, you will need to change the printer selection.

To print a plain-text file, we recommend the command

enscript -P lj218 filename

assuming you are in 218 IST and want to use the printer in that room.  (We will need to modify the command shortly.)

The enscript program will place a header line at the top of the page, with the file's name and last modification date, and the current page number.

Another good program for printing plain-text files is a2ps, which is a mnemonic for "ASCII to Postscript".

a2ps -P lj218 filename

The header used by a2ps includes more information than is in enscript's header.  a2ps uses landscape mode by default, and understands most programming languages well enough to format them neatly.  For example, keywords in C are in bold letters, comments are in italic, and character strings are in a variable-width font.  But you need good eyes; the default font size is pretty small.

Check the man pages for enscript and a2ps for more details, or run

enscript --help
a2ps --help

for a reminder of the options.

Suppose the printed header from enscript is missing or seems to be incomplete, showing only the bottom of each letter.  It's also possible that the last line of the printed page is incomplete, showing only the top of each letter.  What is the cause of this problem, and how do you fix it?  From the enscript man page, in the section describing the command-line options,

     -M name, --media=name
             Select an output  media  name.   Enscript's  default
             output media is A4.

             List the names of all known output  media  and  exit

The output from  enscript --list-media  is

known media:
name             width  height  llx     lly     urx     ury
Letterdj         612    792     24      40      588     768
A4dj             595    842     24      50      571     818
Letter           612    792     38      24      574     768
Legal            612    1008    24      24      588     984
A5               420    595     24      24      396     571
A4               595    842     24      24      571     818
A3               842    1190    24      24      818     1166

So, issue this command instead:

enscript -M Letter -P lj218 filename

The international standard A4 paper is longer and narrower than the US standard Letter paper, which is why a2ps seemed to be cutting off lines at the top and bottom of the page.

The selection of A4 as the default size is made in the file /opt/csw/etc/enscript.cfg .

More later ...

Last revised, 18 Aug. 2011