Jordan Savant // Software Engineer

This contains the various functions for printing in Linux/Unix

Printing anything with `lp` command:
    echo "123" > lp

Printing a file with `lpr` command:

    lpr [ options ] [ filename ... ]

    lpr -#3 file.txt    // will print three copies of file.txt
    cat file.txt | lpr  // lpr reads from stdin as well

Viewing the print queue with `lpq` command:

    lpq

    lp is ready and printing
    Rank    Owner     Job  Files           Total Size
    active  mwf       31   thesis.txt      682048 bytes

Cancelling a print job with `lprm` command:

    lprm -      // cancels all print jobs
    lprm 31     // cancels print job 31

Formatting a file before printing with `pr`:

    pr +4 -d -h"Ph.D. Thesis, 2nd Draft" -l60 thesis.txt | lpr

        +4      // skip first three pages
        -l60    // set page length to 60 lines
        -d      // double space the output
        -h      // add the header to each page

Seeing printers with `lpstat` command:

    lpstat -d -p    // lists all printers and the default printer

Set the default printer with `lpoptions` command:

    loptions -d printerName

Setting options with -o argument:

    lpr -o landscape -o fit-to-page -o media=Letter

    Media Options
    -o media=XYZ
        Letter - US Letter (8.5x11 inches, or 216x279mm)
        Legal - US Legal (8.5x14 inches, or 216x356mm)
        A4 - ISO A4 (8.27x11.69 inches, or 210x297mm)
        COM10 - US #10 Envelope (9.5x4.125 inches, or 241x105mm)
        DL - ISO DL Envelope (8.66x4.33 inches, or 220x110mm)
        Transparency - Transparency media type or source
        Upper - Upper paper tray
        Lower - Lower paper tray
        MultiPurpose - Multi-purpose paper tray
        LargeCapacity - Large capacity paper tray
    -o media=Custom.[width]x[length][dimension]
    -o media=Custom.3x4in

    Margin Options
    -o page-left=value -o page-right=value -o page-top=value -o page-bottom=value
        The value argument is the margin in points; each point is 1/72 inch or 0.35mm.

    Scale Options
    -o cpi=10
        sets the number of characters per inch
    -o lpi=6
        sets the number of lines per inch