nprnt

Uses
Setup
Options
Setting defaults
Making commands
Printer nicknames
Printing part of a text file


Uses

nprnt can be used to print text files, (encapsulated) postscript files, and even some PDF files .  It will NOT print other graphics files (you will end up with a lot of wasted paper and annoyed computer people if you try).  When printing text files, you have the option of only printing certain lines of a text file (this is especially useful on large C files).  Coloring (-col) is here now for C++ and perl code.
 

Setup

To use nprnt, I recommend either adding an alias in your .cshrc (or equivalent
alias nprnt "~cplager/bin/nprnt"
   or making a soft link
unix> ln -s ~cplager/bin/nprnt ~/bin

Options

The options for nprnt are similar (but not exactly the same ) to prnt.  The list of options can be gotten from the command line:
cplager@b0dap30> prnt -h
Usage: nprnt -flags file1 file2...
Flags:
-Aname  -> use options you set up in $PRNT_CMDS
-Cn     -> print text in n columns
-COL    -> print code (currently C++ & perl) text in color
-F[10]  -> does (F1) or does not (F0) flip second side
           (F1 default for 2 per page, otherwise F0 is default)
-FNn    -> print text with font size n
-H      -> this help screen
-Kn     -> print n sides (1, 2 : 2 default)
-L      -> prints in landscape mode
-Mn     -> have margin of n points
-Nn     -> print n pages per side (2 default)
-Pn     -> prints on printer n 
           (must be separate from other options: 'B0TR165A_HP8000' default)
-Rname  -> prints on printer name (name is setup using the $PRNT_NAMES
           environment variable; must be separate from other options)
-Tn     -> replace each tab by n spaces (text files only) (1..20 : 4 default)
-Un     -> print text with (U1) or with out (U0) line numbers (1 default)
-W      -> use alternative duplexing method for postscript
           (not recommended EXCEPT for 'PAW' output, etc.)
Example: prnt -N1K2 -Pmwlw1 print.ps
- prints 'print.ps' 1 per side and 2 side per sheet on mwlw1
Notes:
- nprnt automatically unzips '.gz' files and prints them.
- nprnt automatically converts and prints '.pdf' files.
- nprnt uses the '$PRINTER' as default printer, if it is defined.
PRNT_DEFS = -m
PRNT_NAMES = simplex:B0TR165A_HP8000_S cpap:165A_TCOLOR ctran:165A_TCOLOR_TRANS b0col:B0CTL_TCOLOR b0:B0CONTROL_HP8000
PRNT_CMDS = 3col:-c3 -fn4.9 -l -n1 -f1,2col:-c2 -fn6.9 -l -n1 -f1,2colw:-c2 -fn4.9 -l -n1 -f1,large:-n1 -l -fn15,1colw:-fn4.9 -l -n1 -f1

Setting defaults

The following defaults are standard, but you can change them either by setting an environment variable or from the command line.  Note:  If you change them using the environment variable, you can override the change from the command line.
1) 2 pages per side
2) double sided
3) when printing in 2 pages per side, the reverse side is flipped
4) lines of a text file are numbered

To change any of these, you need to set an environment variable PRNT_DEFS
1) To change the default number of pages per side (lets say to 1 per side), put in -N1 in the variable
2) To make single side your default, add -K.
3) To NOT flip the other side when doing 2 pages per side, add -F0.
4) To not print line numbers of a text file, add -U0.

If I wanted 1 page per size and no line numbers, I would add the following line to my .cshrc file
SETENV PRNT_DEFS "-N1 -U0"

The following defaults are standard, but you can only change them from the command line
1) 1 column per page
2) 10 pt font
3) portrait mode
 
 

Making Commands

There are times that you want to use several options often.  I have 2 examples.  If you want to print 3 columns on 1 side or if you want to print large text, you can set it up as follows:
For 3 columns, I want 1 page per side, landscape mode, 3 columns and a smaller font (4.9 point)
For large text, I want landscape mode, 1 page per side and a large font (15 point)

You want to create an environment variable PRNT_CMDS  that has the name you want to you, a colon, and the list of options.  Separate different commands with a ','.
To set this up I put the following line in my .cshrc
SETENV PRNT_CMDS "3col:-n1  -l -c3 -fn4.9,large:-l -n1 -fn15"
and I can print 3 columns with the following command
unix> nprnt -A3col this.file
or large text with
unix> nprnt -Alarge this.file
 

Using printer nicknames

I always have trouble remembering which printers are named what, so I came up with a way to nickname printers:
Setup an environment variable called PRNT_NAMES that has a list of nicknames and full names separated by a colon.  Different pairs are just separated by a space.  So
SETENV PRNT_NAMES "simplex:tlob_xrx_n32_simplex duplex:tlob_xrx_n32 colpap:w231qmsp coltrans:w231qmst daq:w215_hp_8kdn third:w320hpdup"
has the following pairs
simplex is the nickname for tlob_xrx_n32_simplex, duplex is the nick name for tlob_xrx_n32, etc.

To print with the nickname,
unix> nprnt -Rsimplex this.file
prints this.file to tlob_xrx_n32_simplex.

Printing part of a text file

This is the easiest thing to do.  If you want to print part of a file, simply follow the name of the file with a colon, the line number to start, a comma, and (if you want) the line number to end.
unix> nprnt ~cplager/bin/nprnt:100,200
prints line 100 to 200 and
unix> nprnt ~cplager/bin/nprnt:100,
prints line 100 to the end

This page was written and is maintained by Charles Plager. November 4, 2003