|
||||||||||||||
More about Printing from ITS Unix Machines |
|||||||||||||
| Choosing a Print Resource This document introduces you to the printing services available from ITS Unix machines. Many printers are available to Unix users, so the choices can be rather confusing. To obtain assistance, use the following command:
on any ITS Unix host. This will generate a manual page containing a list of available printers explaining where they are located and their capabilities. As you look at the various printer descriptions, notice that we only have PostScript printers. PostScript is a document formatting language created by Adobe Systems. PostScript printers are able to interpret and print PostScript formatted files. You can submit plain text to a PostScript printer, and it will print successfully. You cannot, however, submit PostScript to a text printer, as you will receive a long printout of PostScript language commands instead of your file. PostScript printers do offer users some enhanced printing capabilities that will be discussed later. The lpr Command Also included in the man printers output is information explaining how to actually print something. There are two basic commands that can be used for printing files on ITS printers. The first is the basic Unix print command, lpr. In order to send a file to one of the printers named in the man printers listing, simply use the lpr command as follows:
This will send the named file to the specified printer. For example, suppose you wanted to print a copy of your latest C program code on the HP4Si MX printer in Norlin Library. The following command will accomplish this task:
The lpr command can also be used to submit a PostScript file to a PostScript capable printer. To send a PostScript graph you created to the laser printer in the Engineering Center, Classroom Wing 252 (NAC), use the following command:
A common problem occurs when a very large file, over one megabyte, is submitted for printing. Complicated PostScript files are often very large. Normally, when a file is printed, it is first copied to a "spooling" area where it stays while being sent to the printer. The largest file that may be copied there is one megabyte. If you need to print something larger than one megabyte, use the -s option with the lpr command as follows:
The -s option causes lpr to make a link to your file instead of trying to copy it to the spool area. For more options on the lpr command, type man lpr. The enscript Command Another print command is called enscript and may be used only with PostScript printers. Enscript takes a plain text file and converts it to PostScript for printing. This means that you can change many of the document's features, such as font style and size, orientation (portrait or landscape), and how many pages appear on one sheet of paper. The enscript command is similar to the lpr command in usage:
The only requirement is that printername be a PostScript printer and file is a plain text file. Used in this manner, enscript will print the file in its default font, which is Courier 10 point. Suppose you had a file that you wanted to print in 24 point bold Helvetica. You could use enscript as follows to do it:
All of the available fonts for enscript can be listed with the following command:
The fonts appear to be different in the listing from the way that you specify them with the enscript command. The Helvetica font used above appears in the list of fonts as HelvBo.afm. Similarly, the font file PalBo.afm becomes Palatino-Bold with the enscript command. You can always add a point size to the end of any font name with enscript. Another useful feature of enscript is its ability to print several pages on one sheet of paper. Suppose you needed to print a long file and wanted to save paper by printing two pages on each sheet, you would use the command:
The -2r option tells enscript to rotate the output to landscape mode and print two pages on each sheet. This is a good way to print program listings. If you had a file that was very wide, perhaps 132 columns, you might use enscript with the -r option to print the file in landscape mode, but with only one page per sheet:
The enscript command has many powerful options; use man enscript for all the details. Customizing Your Printing Environment Whether you are using lpr, enscript, or both, you may find that you are almost always sending output to the same printer. If that is the case, you can make life a little easier by setting the PRINTER shell environment variable to the name of the printer that you use. If PRINTER is set, lpr and enscript will automatically send print jobs to that printer. You don't need to specify the printer with the -P option on the command line. The following commands will set the PRINTER environment variable:
You may want to add these lines to your .profile file so it takes effect each time you log on. If, instead of ksh, you are using csh or tcsh as your shell, the command to use becomes:
Similarly, you may want to add this line to your .login file to run automatically upon login. Once PRINTER is set to your printer of choice, you can omit the -Pprintername parts of the commands shown above. PostScript Tools While PostScript files are printed with lpr, there are several tools available that allow existing PostScript files to be modified. With them, you can select specific pages of a document to be printed, print multiple pages on each sheet of paper, format a document in book style, perform scaling, and more. Remember, these tools can be used only on existing PostScript files. The psselect Command The psselect command allows you to specify a range of pages to be printed from an existing PostScript file. Suppose you wanted to print only the first 10 pages of a long PostScript document called book.ps. You could use psselect as follows:
The psselect command does not actually send to the printer, making it necessary to send its output through the lpr command. Similiarly, you might want pages 1-5 and page 20:
Type man psselect for more details. The psnup Command The psnup command lets you print multiple pages of a PostScript document on a single sheet of paper. The following example illustrates how you would print a document with two pages appearing on each sheet of paper:
Again, the output of the psnup command is redirected into the lpr command to send to the printer. Type man psnup for details. Several other utilities, psbook , pstops, and pslpr are also available. Interested users should look at the manual pages for these commands. Getting Help |
|
||||||||||||
| Support | | | Training | | | Facilities | | | About ITS | | | ITS Home | |||
|
|||||||||||