Printing and Options 

CUPS provides both the System V (lp(1)) and Berkeley (lpr(1)) printing commands for printing files. It's online help provide detail usage examples.

CUPS On-Line Help -> Getting Started -> Printing and Options http://localhost:631/help/options.html?TOPIC=Getting+Started&QUERY=

It covers:

Canceling a Print Job

Choosing a Printer

N-Up Printing

Pretty Printing

Printing Files

Printing Multiple Copies

Printing On Both Sides of the Paper

Printing the Output of a Program

Raw or Unfiltered Output

Scaling to Fit

Selecting a Range of Pages

Selecting Even or Odd Pages

Selecting the Banner Page(s)

Selecting the Media Size, Type, and Source

Setting the Default Printer

Setting the Number of Characters Per Inch

Setting the Number of Columns

Setting the Number of Lines Per Inch

Setting the Orientation

Setting the Page Margins

Specifying Printer Options

Standard Printing Options

Text Options

documented on: 2006.11.11

Locating the Personal Default Destination 

The default destination is located differently depending on the command.

The lp command locates the default destination in the following order:

  1. lp command's -d destination option.

  2. LPDEST environment variable.

  3. PRINTER environment variable.

  4. _default destination in $HOME /.printers.

  5. _default destination in /etc/printers.conf.

  6. _default destination in FNS.

The lpr, lpq, and lprm commands locate the default destination in the following order:

  1. lpr command's -P destination option.

  2. PRINTER environment variable.

  3. LPDEST environment variable.

  4. _default destination in $HOME /.printers.

  5. _default destination in /etc/printers.conf.

  6. _default destination in FNS.

Making use of the default printer 

Newsgroups: gmane.linux.debian.user
Date: Sun, 16 Sep 2007

What's the "Default Printer" actually means?

I've setup one of my printers to be "Default Printer", http://localhost:631/printers/

and I unset the LPDEST environment variable, in hoping the consequent lpr will be using the "Default Printer", but this is what I get:

lpr: Error - LPDEST environment variable names non-existent destination ""!

So, how can I make use of the default printer without specifying any environment variables?

*Edit:*

I thought I've unset the LPDEST environment variable, but I found I just set it empty. unset all printer related environment variables solved the problem.

Making use of the default printer 

> how can I make use of the default printer without specifying any
> environment variables?

just use "lpoptions -d foo" to set this the default for your user (if you want a special printer to be a default for a certain user)

otherwise set the default printer from the CUPS page and simply use lp as the wrapper from the command line….

Martin Marcher @marcher.name

Making use of the default printer 

> hmm, same error:
>
>  $ lp test.ps
>  lp: Error - LPDEST environment variable names non-existent destination ""!
>
> Anything wrong with my system?

there could be something that set's the LP environment variable

# echo $LP
#env |grep LP
#set |grep LP

and see which LP is set to something possibly weird/wornd

as an intermediate solution if the variable is set

# unset LP

of course for a permanent solution you should try to find the program/daemon that is setting LP (if you don't want it which i suspect)

does

# lp -d yourPrinter testfile.pdf    # yes lp handles pdf files "just right" also ps

work as you'd expect it (with LP set and LP unset) if so then you really just need to get rid of the automatically created environment variable LP…

Martin Marcher @marcher.name

pdf printing 

Newsgroups:  gmane.linux.debian.user
Date:        Wed, 4 May 2005 12:50:19 -0800
> Yesterday i wanted to print a pdf book, but i didn't find any app in
> gnome2.8 in wich i can print the odd and even pages. i tried with
> gpdf, xpdf and evince.
> My printer is configured with cups.
> Anyone knows any app to do so?; i don't want to install acrobat reader.
> Maybe with a cups command to print?
$ lpr -o page-ranges=1-20 -o page-set=odd foo.pdf
$ lpr -o page-ranges=1-20 -o page-set=even foo.pdf

I've never tried the -o page-set option, but give it a whirl and let us know.

Christopher S. Swingley

pdf printing (the most beatiful command) 

This is it!! this has changed my life :p the page-set=odd or even works like expected the only thing is i'm using lp instead of lpr.

thanks a lot to all of you.

David Roguin