cmd:mpage 

Usage 

no index 

file names give on the commnad line can't have index

mpage `lf` | lp -w &           # all files
mpage `findh fnew . 60 | cut -d'/' -f 2 | sort` | lp -w &      # new files
mpage -x  # usage display
MPAGE="-o2fX -bLetter -m50t"    # noframe, 2col, wordwrap, Pagehead (simplex)
mpage *.C | lpr -C"letter hduplex"
MPAGE="-tTo2fX -bLetter -m50t40b" # hduplex, noframe, 2col, wordwrap, Pagehead
mpage -c -s3 -o                # concat pages, tabstop width (3), show frame
MPAGE="-l1fX -bLetter"          # landscape 1 column, wordwrap, Pagehead
mpage file...

help 

-1, -2, -4, -8  Pages per sheet (4)    -v Toggle verbose output, (on)
-a Toggle across/updown layout (u)     -l Toggle portrait/landscape (p)
-f Toggle folding long lines (off)     -o Toggle printing outlines (on)
-E Print every second and third page   -O Print every first and fourth page
-s Define tabstop width (8)            -k kill on %TRailer is PS file
-b papersize (A4), use l of ? to get a list of sizes
-R Switch to across mode, with first page at lower left corner
-H Create page header for each page for text files
-X Print physical page header (filename + physical pagenumber)
-c Toggle concat pages of different files on same sheet (off)
-B Specify textbox margin/thickness (no space): [<num>[lrtb]*]*
-m Specify sheetmargin (no space): [<num>[lrtb]*]*
-M Specify pagemargins (no space): [<num>[lrtb]*]*
-z Specify print command (lpr).
-j Print specified sheets: first[-last][%interval]
   -j 1-10 does first 10 sheets, -j 1%2 prints odd ones, -j 2%2 even ones.
-t Toggle printing both sides of the paper (Duplex mode, off)
-T Toggle tumble of every second pages when printing in duplex mode (off)
-bpapertype
     Prepare  output for selected paper type.  Papersize can
     be A3 for European A3, A4 for European A4,  Letter  for
     US  Letter or Legal for Legal sized paper.  For default
     see 'mpage -x'.  To see the list of currently available
     types, just give the 'mpage -bl' or 'mpage -b?' command
     (Note: mpage exits after finding such option use.)
-m[<num>[lrtb]*]
     Specify  sheet margin. The default margin is 20 points.
     Only specifying -m sets left margin to 40  points.   l,
     r, t or b set left, right, top or bottom margin respec-
     tively to <num> points.   Not  specifying  any  of  the
     sides  will  set  all sides when <num> is given.  <num>
     defaults to 40 points. For example -m10 sets  all  mar-
     gins to 10 points.  -ml50tb sets left margin to default
     40  and  top  and   bottom   margin   to   50   points.
     -m50l25bt30r set bottom and top margin to 25, left mar-
     gin to 50 and right margin to 30 points.   Margins  can
     have  negative  numbers.   Very large values have funny
-M[<num>[lrtb]*]
     Specify  logical  page  margins.  For  syntax,  see  -m
     option.  Defaults are 4 for -M solely, and 8 for <num>.
     Margins can be negative.  This way large white  borders
     in  your  (postscript)  documents can be reduced.
-o   Toggle  printing  of  outlines around each reduced page
     (default on).
-t   Toggle  printing on both sides of the paper.  This will
     toggle duplex mode of the  printer.   Use  this  option
     only  if  your printer is capable of printing in duplex
     mode.  (default off).
-v   Toggle printing a count of the number  of  sheets  pro-
     duced for printing (default off.)
-x   Force usage display, which also shows current defaults.
mpage  also  examines  the  MPAGE  environment  variable for
default option  settings.   Any  option  or  combination  of
options  can be specified in the MPAGE environment variable.
-2fzXc -bLetter (doesn't work,  04-10-99)
-2fX -bLetter (works,  04-10-99, *N*: nothing should follow -X)
Any  command line options will toggle from MPAGE environment variables
setting.

Example 

set environment var MAPGE & LPDEST properly,

normal:

mpage  | lp -m -o hd

advanced:

mpage  | lp -m -o hd -q 0  -n 2 -o topaz
                     ^1^   ^2^
  1. highest priority

  2. print 2 copies

The usage of -q to set priority can not move you to the top. :-)

Version 2.5.2 

24-Jan-2002

Source 

http://www.linux.org/apps/AppId_2219.html
http://www.mesa.nl/pub/mpage/mpage-2.5.2.tgz

Build & Installation 

Steps 
make
cd test
../mpage testpage > t.ps
..
make install
Help 

All you should need to do is run make.

This will create the programs mpage and msample. Mpage is the program to print n-up pages. Msample prints a sample outline. I used it for debugging the placement of the layout. It is also handy for other layout purposes. It accepts all the arguments that mpage does, but does not print files.

Trying History 

Not work under cygwin 
/cygdrive/c/try/mpage-2.5.2/test$ ../mpage testpage > t.ps
Segmentation fault (core dumped)
/cygdrive/c/try/mpage-2.5.2/test$ ../mpage nonl > t.ps
Segmentation fault (core dumped)

documented on: 02-08-99

enscript 

Info 

Description 

GNU enscript is a free replacement for Adobe's Enscript program. Enscript converts ASCII files to PostScript™ and spools generated PostScript output to the specified printer or saves it to a file. Enscript can be extended to handle different output media and includes many options for customizing printouts.

Source 

http://people.ssh.fi/mtr/genscript/

Related Urls 

Comments 

want to create highlighting definitions for a new language or file format? See file /usr/share/enscript/hl/enscript.st for examples.

Version 1.6.3-3, cygwin 

Configuration & Twisting 

cp /etc/enscript.cfg.default /usr/share/enscript/enscript.cfg

Booklet printing 

tkref-8.0.2 is a good demonstration on how to twist a ps file for booklet printing, and how to generate such booklet-printing-enabled ps files from tex source.

%% refbase.cls -- standard document class for Perl Reference Guide
%% RCS Status      : $Id: refbase.cls,v 5.10 1995/12/24 15:03:07 jv Exp $

Printing under Cygwin 

Simple 

http://www.cis.upenn.edu/~mcken/prj/win32/hints/printing.html

To print text and PostScript files from a Windows command shell, use either the GNU/Cygwin cat command (in p:/cygwin-b20/H-i586-cygwin/bin) or the WinNT print command (in c:/WinNT/system32). For example, here's how to print from a t-shell to Grasp queue grasp3:

pc:-> cat file.txt  > '\\grasp\grasp3'
pc:-> cat file.ps   > '\\grasp\grasp3'
pc:-> print /D:'\\grasp\grasp3' file.txt
pc:-> print /D:'\\grasp\grasp3' file.ps

Ps printing under Cygwin 

/cygdrive/c/gs/gsview/gsprint golfer.ps

notes 

Defaults are -mono -noquery -noprinter -all

-noquery
        Don't show printer setup dialog
-noprinter
        Use default printer
-all
        Print all pages
Useful options 
-portrait
        Portrait orientation
-landscape
        Landscape orientation
-duplex
        Duplex (vertical axis)
-copies NN
        Print NN copies (if supported by Windows printer driver)
partial printing 
"-from 100 -to 100"
-from NN
        First page to print is NN
-to NN
        Last page to print is NN

PS hacking for on/off single-sided printing 

http://www.cis.upenn.edu/~mcken/prj/win32/hints/printing.html

You can modify your PostScript document directly to turn on/off duplex printing. To do so, you simply open your PostScript file in a text editor and add a bit of code between the %%BeginSetup and %%EndSetup DSC (document structuring conventions) comments.

To enable standard duplex printing along the long edge, insert this code:

mark {
%%BeginFeature: *Duplex DuplexNoTumble
    <</Duplex true /Tumble false>> setpagedevice
%%EndFeature
} stopped cleartomark

To enable duplex printing along the short edge, insert this code:

mark {
%%BeginFeature: *Duplex DuplexTumble
    <</Duplex true /Tumble true>> setpagedevice
%%EndFeature
} stopped cleartomark

To disable duplex printing, insert this code:

mark {
%%BeginFeature: *Duplex None
    <</Duplex false>> setpagedevice
%%EndFeature
} stopped cleartomark

This workaround applies only to the Lab's HP LaserJet printers with duplexing units. The mark/cleartomark construct provides some simple error handling in case the modified document is sent to a printer that cannot implement this code. It causes the PostScript interpretor to quietly ignore any errors that the enclosed setpagedevice operator would raise, as if the operator were not there at all. So you can still print your document to grasp301 and grasp-tek, which do not support duplexing.

To specify single-sided printing in windoze 

Lab printers grasp2, grasp3, and grasp339 use double-sided printing by default. You can (usually) override this default to get single-sided printing.

For a Windows application, you can often specify single-sided printing from the Print dialog. In general, navigate to and click the Layout tab. In the panel Print on Both Sides (Duplex Printing), select None. Here are the details under Microsoft Word, for example:

Some applications do not offer this feature. For these, print you document to a PostScript file and use one of the following approaches.

Under Solaris, you can use the psprint command to force a PostScript document to print single-sided:

grasp:-> psprint -s [-P<printer>] file.ps

cmd:html2ps 

Usage 

Casual Printing 
html2ps -T $fl > $tf; gv $tf
lpr -hw $tf
-w
   Writes a message on the user's terminal after the files have
   been printed.
follow links within/below directory 
html2ps -T -W b -C h toc.html
Picture Printing 
html2ps -2 -L -C h -W b RNI-index.html | lpr -C"letter hduplex" &
Settings 
alias html2ps='html2ps $HTML2PS'
 HTML2PS=-2 -L
  1. two columns

  2. Landscape

Change page setting 

in ~/s/scripts/tdat/html2psrc:

paper {
  type: letter;
}

change it from letter to A4.

Version 1.0b3 

16-Aug-2000, <<:2002.08.10 Sat:>>

http://www.tdb.uu.se/~jan/html2ps-1.0b3.tar.gz

Installation 

run ./install!

Version: 1.0b1 

Source: http://www.tdb.uu.se/~jan/html2ps-1.0b1.tar.gz []

documented on: 06-22-99

Installation 

Unpack, run ./install, it will collect the path for everything it needs then ask lots of questions of which to be installed where. Better answer the first path with *abs* home addr, i.e. /home/…/tongsun/

install path: /opt
ln -s  ~/s/scripts/tdat/html2psrc /opt/lib/html2ps/html2psrc

Test run 

alias html2ps='html2ps $HTML2PS'
html2ps -T -C h html2ps.html | lpr -C"letter hduplex" &

Run 

html2ps -f :pj perlform.html | lpr -h &
-f include in other options file

Config file 

Use local configuration file ($HOME/.html2psrc)

Comments 

pro - Works fine for pod2html outputs. - The "autosize" feature of PS for the <PRE> output is really neat! - Size perfect when doing a 2-up printing

con - Can't work for all cases (e.g. unix??.htm). - Works fine for most of them. - Option "-W a" (follow all links) does a poor job and did not gather all, nor did it get in the right order. Test on notes 3703. but -W b seems works fine!

Help 

Detail Help 

DSC compliance

By default html2ps produces PostScript code that is not DSC compliant. The
practical implication of this is that it will not be possible to use the
code with PostScript filters for n-up printing, reordering of pages, etc.
It is also not possible to jump to a certain page directly in previewers
such as Ghostview.
The advantage with the non-DSC code is that it can be 'reused' by html2ps:
you can rebuild an already generated PostScript file using new command line
options and configuration files. This is done by running html2ps with the
new options, and with the old PostScript file as input. This can save a lot
of time and bandwidth when converting remote documents.
It is possible to generate DSC compliant PostScript by using the option -D,
but this requires that Ghostscript is installed, and it can take quite some
time to do. Note: if you are producing PostScript files for others to
download and print, it is strongly recommended that you generate DSC
compliant code (i.e. convert with the -D option).

Option "-W b" (follow links within/below directory) 

Usage 

html2ps -T -W b -C h toc.html > $tf; gv $tf

Trying History 

host:~/man/emacs>html2ps $HTML2PS -T -W b -C h emacs_toc.html > e.ps
Reading emacs_toc.html
At least 48 documents remaining
*** Error opening emacs_1.html
*** Error opening emacs_2.html
*** Error opening emacs_3.html
Reading emacs_4.html
At least 44 documents remaining
Reading emacs_5.html
At least 43 documents remaining
...
Reading emacs_9.html
At least 39 documents remaining
Reading emacs_10.html

Note:

documented on: 12-18-98

html2ps limitation 

"rowspan" 

I now think it is because of "rowspan"

html2ps failure 

c++ in url, just remove it.

grep -i c++ !$
sed 's/c\+\+/cpp/g' < !$ > new-!$

html2ps failure 

Another case that html2ps fails: another book from mcp. After an extensive delete and try. I found out that the html2ps can't handle the tag:

<HR ALIGN=CENTER>

after changing it to <HR>, it works perfect.

Command to change them all:

ls *.htm | doeach.pl "perl -i -pe" '@"s/<HR ALIGN=CENTER>/<hr>/@"'  @_

baes href 

html2ps recognize the line

<!-- <BASE HREF="http://www.pbs.mcp.com/ebooks/1575211750/"> -->

so, better change it before doing a -W b operation. I just changed it to

<!--  BASE HREF="http://www.pbs.mcp.com/ebooks/1575211750/"  -->

finially 

html2ps -2 -L -C h -W b -T index.htm > apache.ps 2>err_log
ghostview apache.ps &
lpr -C"letter hduplex" -m apache.ps &