LinuxCommandLibrary

mpage

Arrange multiple pages onto one printed page

SYNOPSIS

mpage [options] [file]

PARAMETERS

-1
    Format one logical page per physical page.

-2
    Format two logical pages per physical page (default).

-4
    Format four logical pages per physical page.

-8
    Format eight logical pages per physical page.

-f
    Force printing of pages even if they are mostly empty.

-o
    Set the orientation to 'portrait' or 'landscape'.

-B
    Set the paper size. Available options: letter, legal, a4, a3, a5

-A
    Disable automatic resizing of text to fit page.

-s
    Scale font. Number between 0.1 and 2.0

-r
    Rotate even numbered pages 180 degrees for duplex printing.

-P
    Print directly to the specified printer (using lpr).

-q
    Quiet mode (suppress warnings).

-u
    Add custom header text string.

-h
    Add a heading to each page in the form of page %d.

-v
    Display version information.

DESCRIPTION

The mpage command is a versatile tool for formatting text files for printing, allowing you to squeeze multiple logical pages onto a single physical page. This is useful for saving paper and reducing printing costs. mpage takes text input, either from a specified file or standard input, and arranges it into a multi-page layout suitable for postscript printers. It supports various options to control the number of logical pages per physical page, margins, headers, footers, and other aspects of the output format. It is often used to prepare man pages, source code, and other text-based documents for efficient printing. By default, mpage uses a reasonable layout for fitting multiple pages, but you can customize it precisely to fit your needs. The standard output is postscript.

CAVEATS

mpage generates PostScript output, so you need a PostScript printer or a PostScript interpreter (like Ghostscript) to view or print the output correctly. The formatting may not be perfect for all types of text files, especially those with complex formatting requirements. The output generated can also sometimes be very large and slow to be processed by old printers.

USAGE EXAMPLE

Example of how to create a 2 page per sheet postscript file named output.ps:
mpage -2 input.txt > output.ps

FILE HANDLING

If no file is specified, mpage reads from standard input. If printing to a printer is enabled the postscript file is generated in a temporary location. After the file is sent to the printer the temporary file is deleted.

HISTORY

The mpage command was developed to facilitate the printing of text documents on multiple pages per sheet, primarily motivated by a desire to conserve paper. It gained popularity in Unix-like environments where efficient printing of documentation and code was a common need. The command has evolved over time to incorporate features such as orientation control, paper size selection, and header/footer customization, making it a flexible tool for preparing text files for printing.

SEE ALSO

a2ps(1), enscript(1), ghostscript(1)

Copied to clipboard