Why don't applications respect a printer's default options?

Summary: you're probably seeing the options for the last instance in ~/.cups/lpoptions.


There are both system-wide defaults and per-user defaults.

The system-config-printer application and the CUPS web interface configure system-wide defaults. These are stored in /etc/cups/printers.conf and /etc/cups/ppd/NAME.ppd where NAME is the name of the printer. In a .ppd file, an option setting line looks like this:

*DefaultDuplex: DuplexNoTumble

The possible values for this option, which is called Duplex, are given by lines like

*Duplex None/Off: …
*Duplex DuplexNoTumble/Long-Edge Binding: …
*Duplex DuplexTumble/Short-Edge Binding: …

The part after the colon describes the commands to send to the printer to activate the setting. The part before the colon consists of a *, then the name of the option, then a space, then one or more names for the value separated by slashes (for example, “None” and “Off” mean the same thing for this particular option, you can use them interchangeably).

You can also have per-user defaults stored in a file called .cups/lpoptions in your home directory. The syntax of this file looks like this:

Dest lj/single Duplex=None
Default lj Duplex=DuplexNoTumble

A line like Dest lj/single … defines an instance called single of the printer called lj. When printing to that instance, the Duplex option is set to None. When printing to the default instance, the Duplex option is set to DuplexNoTumble (i.e. double-sided). The line Default lj … defines default options when printing to lj. These options override the system-wide defaults. The use of Default rather than Dest makes lj the default printing destination.

(You can also have a system-wide /etc/cups/lpoptions. Why have a system-wide file, which might seem redundant with the options set in the .ppd file? The difference is that if your computer acts as a print server from other computers, the .ppd file applies to all, whereas /etc/cups/lpoptions only applies when printing from the local computer.)

You can use instances to make different sets of options available under a nickname from the command line. For example, with the lpoptions file above, lp -d lj prints double-sided and lp -d lj/single prints single-sided. Instances are also visible in some GUIs, for example in the KDE print dialog.

The Gnome print dialog does not show different instances, you only get one. However, rather counter-intuitively, Gnome doesn't default to the options for plain lp, but instead picks the last instance that was mentioned in the lpoptions file. So for example, with the lpoptions file above, the default is duplex printing, but if the two lines were swapped, the default would be single-sided.

Another trap with Gnome is that it also reads the file ~/.lpoptions. This is an old location for ~/.cups/lpoptions, which the printing system doesn't read anymore since Ubuntu 12.04 or thereabouts, but which Gnome still reads as of Ubuntu 14.04. If you have one, rename it to .cups/lpoptions or delete it.


I found that many applications (for example, firefox, evince, gThumb) follow the settings in ~/.cups/lpoptions Use a text editor to update your favourite settings.

To list all available options use the command

lpoptions -l

To check the available duplex configuration for example use

lpoptions -l | grep -i duplex

shows:

Duplex/2-Sided Printing: None *DuplexNoTumble DuplexTumble

To check the available printing quality options

lpoptions -l | grep -i StpQuality

shows:

StpQuality/Print Quality: None Economy *Draft Standard High Photo HighPhoto UltraPhoto Best

Ah ha! I looked at the hidden files in my home dir and found one called .cups which contained an lpoptions file.

No idea how that got there, but deleting the folder makes my defaults work again.

Sanity restored!