lpadmin -p hppsc -E -v smb://print:print@emerald/hp1200 -P /base/usr/share/cups/model/hppsc1200.ppd
lpadmin -d hppsc
lpadmin -p hpdj  -E -v socket://192.168.4.26 -P /base/usr/share/cups/model/hpdj6127.ppd
lpadmin -d hpdj
lpadmin -p hplj  -E -v socket://192.168.4.25 -P /base/usr/share/cups/model/hp_laserjet_4plus-hpijs.ppd
lpadmin -d hplj

--------------------------------------------------------------------------------

lp  [-d destination ] [-n number of copies ] [-o options ] filename
lpr [-P destination ] [-# number of copies ] [-o options ] filename

print from stdin
	program | lp -d printer
If the program does not provide any output, then nothing will be queued for
printing.

lpoptions
	sets options used by lp and lpr when submitting jobs.
	when run by root, sets options for all users in the lpoptions file.
	when run by user, sets options in the file ~/.lpoptions.
	-l - lists the printer specific options and their current settings.
	-o option=value
	   specifies a new option for the named destination.
	-p dest/instance
	   sets the destination and instance, if does not exist, it is created.
	-r option
	   removes the specified option for the named destination.
	-x dest/instance
	   removes  the  options  for  the named destination and instance.
	if no options are specified using -o, then the current options are
	printed for the named printer.


using two-sided printing:
	lp -d printer -o sides=two-sided-long-edge  filename
	lp -d printer -o sides=two-sided-short-edge filename
	lp -d printer -o sides=one-sided            filename

set two-sided for default (persistent) option:
	lpadmin -p printer -o sides=two-sided-long-edge

no-banner option:
	lpadmin -p printer -o banner=never

lp -o scaling=90 dilbert.gif

The foomatic filters also have support for other options, which I have not
fully explored yet. For example, this foomatic-rip option can select the
type, size, and location of print media:
	-o media=x,y,z

This option can specify the paper size, tray, and type of paper:
	-o media=Letter
	-o media=Letter,MultiPurpose
	-o media=Letter,Transparency
	-o media=Letter,MultiPurpose,Transparency

Paper sizes can be one of the following:
	Letter, Legal, A4, COM10, DL

Trays are defined by the PPD, but examples might be:
	Upper, Lower, MultiPurpose, LargeCapacity


Some common job options are listed below. For a complete list, see the
Standard Printer Options section of the CUPS Software Users Manual at
http://www.cups.org/documentation.php/options.html

landscape
	Changes the paper orientation to landscape.

number-up=value
	Determines the number of document pages printed per page.
	Values may be 1, 2 or 4.

job-sheets=value
	Selects the type of banner page used before the print job.
	The most common values are 'none' and 'standard'.

sides=value
	Sets duplexing. To select single-sided printing, use a value of
	'one-sided'. For two-sided printing, possible values are
	'two-sided-short-edge' and 'two-sided-long-edge'.

raw
	The -o raw option allows you to send files directly to a printer
	without filtering. This is sometimes required when printing from
	applications that provide their own "printer drivers" for your
	printer: lp -o raw filename

--------------------------------------------------------------------------------

If your printer is networked, you can use this technique to set up
different queues with different default options, which I find quite
useful:

# lpadmin -p laser \
  -v /dev/null -m netstandard_foomatic  -o protocol=bsd,dest=laser \
  -T PS -I postscript \
  -n /usr/local/ppds/br_5170_2.ppd

# lpadmin -p lduplex \
  -v /dev/null -m netstandard_foomatic  -o protocol=bsd,dest=laser \
  -T PS -I postscript \
  -n /usr/local/ppds/br_5170_2.ppd \
  -o sides=two-sided-long-edge

# lpadmin -p sduplex \
  -v /dev/null -m netstandard_foomatic  -o protocol=bsd,dest=laser \
  -T PS -I postscript \
  -n /usr/local/ppds/br_5170_2.ppd \
  -o sides=two-sided-short-edge

--------------------------------------------------------------------------------

lpc - line printer control program
lpc status

CUPS HTTP Interface:
	http://localhost:631

CUPS commands:
	accept	accept/reject jobs sent to a destination (accept print jobs)
	cancel	cancels existing print jobs (-a will remove all jobs)
	disable	stop/start printers and classes (-c cancels all jobs)
	enable	stop/start printers and classes
	lp	print files
	lpadmin	configure cups printers and classes
	lpmove	move a job to a new destination (lpmove  
	lpstat	print cups status information (-o  shows job queues)
	reject	accept/reject jobs sent to a destination (reject print jobs)


lpadmin switches:
	lpadmin [ -E ] [ -h server ] -d destination
	lpadmin [ -E ] [ -h server ] -p printer  option(s)
	lpadmin [ -E ] [ -h server ] -x destination
	-p - printer name
	     CUPS allows printer names to contain any printable character
	     except SPACE and TAB. Also, printer and class names are not
	     case-sensitive.
	-d - default printer (-d printername) (user defined by $PRINTER)
	-x - delete printer  (-x printername)
	-m - set ppd file from the model directory (-m model.ppd (no path)).
	-o - name=value, sets a PPD or server option for the printer
	-u - permissions for printer. -u allow:user,user,@group
	   -u deny:user,user,@group -u allow:all -u deny:none
	   Sets user-level access control on a printer. Names starting with
	   "@" are interpreted as UNIX groups. The latter two forms turn
	   user-level access control off.
	-v device-uri
	   Sets the device-uri attribute of the printer queue. If device-uri
	   is a filename it is automatically converted to the form
	   file:/file/name.
	-D - Textual description of the printer.
	-E - enable the printer and accept jobs (same as enable/accept).
	-L - Textual location of the printer.
	-P ppd-file
	   Specifies a PostScript Printer Description file to use with the
	   printer. If specified, this option overrides the -i option
	   (interface script).

To create print queue to file:
	lpadmin -p printer -v file:/file/name

To create TCP/IP RAW printer:
	lpadmin -p printer -v socket://192.168.1.90
	lpadmin -p printer -v socket://printer.site.it
	lpadmin -p printer -v socket://printer.site.it:9100

list options for lpadmin -o switch:
	lpoptions -l

--------------------------------------------------------------------------------

Print servers are defined by the ServerName parameter in /etc/cups/client.conf
User-specific servers are created adding the ServerName parameter in ~/.cupsrc
The default printer is defined in /etc/cups/lpoptions, e.g.:
	cat /etc/cups/lpoptions
	Default lpscci

Users can overide the value either setting the environment variable PRINTER or
creating the file ~/.lpoptions with personal customization.

CUPS configuration files:
classes.conf	define printer classes, manipulate using lpadmin
client.conf	define the default server name for client machines,
		e.g.: ServerName prserveri.bo.infn.it
cupsd.conf	cusomize the CUPS server (/usr/sbin/cupsd) edit by hand
mime.convs	list of standard file conversion filters (do not edit)
mime.types	list of standard file formats (do not edit)
printers.conf	information on each printer, manipulate using lpadmin

CUPS directories
/etc/cups			configuration files
/etc/cups/cert
/etc/cups/interfaces
/etc/cups/ppd
/usr/share/cups			customization directories:
/usr/share/cups/banners
/usr/share/cups/charsets
/usr/share/cups/data, 
/usr/share/cups/fonts
/usr/share/cups/model
/usr/share/cups/templates 
/usr/share/cups/doc-root

--------------------------------------------------------------------------------

To choose printer when printing:
	lp -d printer-name namefilename

To see a list of supported devices, you can run the following command:
	lpinfo -v
The first word in each line is the type of device (direct, file, network,
serial), followed by the device URI.

To add a printer from the command line, you can use the lpadmin command:
	lpadmin -p printer -E -v device -m ppd
Here printer is the name of the printer, device is the path to reach the
printer, and ppd is the name of the PostScript Printer Description file.

For example, you would use this for a networked HP LaserJet printer using a
JetDirect network interface at IP address 11.22.33.44:
	lpadmin -p Laserjet -E -v socket://11.22.33.44 -m laserjet.ppd

--------------------------------------------------------------------------------

To find out what's going wrong, first you should increase the log level. To
increase the log level, edit the configuration file /etc/cups/cupsd.conf and
set the LogLevel variable to debug instead of info:
#/etc/cups/cupsd.conf:
	LogLevel debug
Then restart the scheduler and look at the files access_log and error_log in
the /var/log/cups directory.

--------------------------------------------------------------------------------

Under CUPS the PPD files are usually stored as /etc/cups/ppd/.ppd and
under PPR you find them normally in the /usr/share/ppr/PPDFiles/ directory.

If your printer is on a remote CUPS server, you can easily download the PPD
file to your client with:
	wget http://:631/printers/.ppd

http://www.cups.org/documentation.php

--------------------------------------------------------------------------------

CUPS Driver Information

/usr/sbin/lpinfo -m		show available drivers  
/usr/sbin/lpinfo -v		show available printer devices 

--------------------------------------------------------------------------------

use lpoptions to lock down default settings

To see the options available for your setup, send a print job with only the
option 'docs', like this:
	lp -d foo1 -o docs /etc/hosts
This will make foomatic-rip print out an option summary (instead of the actual
print job). You can also download and install lphelp
(Usage: 'lphelp  | less') to display the options nicely on the screen
or use 'lpoptions -p  -l' which displays also the options, but not so
nicely.

Usually, you can also use the media=..., sides=..., and duplex "standard" CUPS
options as documented in the CUPS user manual; they should work if there are
InputSlot, MediaType, and/or Duplex options for your driver.

Options can also be supplied only to selected pages when Foomatic is used.
To apply an option to specific pages prepend the option with a page specification
separated by a colon:

	$ lp -d foo1 -o 1:InputSlot=Letterhead -o InputSlot=Standard file
	$ lp -d foo1 -o even:Watermark=on -o odd:ColorMode=Gray file
	$ lp -d foo1 -o 1,6-10,15,20-:MediaType=YellowPaper file

The first line in the example prints the first page on letter head paper and
the rest on standard paper. The second line prints the even-numbered pages with
watermark and the odd-numbered pages in grayscale. The third line prints the
first, the 6th to the 10th, the 15th, the 20th, and all later pages on yellow
paper, the rest on standard paper.

The syntax is "even", "odd", or giving comma-separated page numbers or page
ranges. Option settings with page selection override option settings for the
whole document on the appropriate pages. More specific (less pages selected)
settings override less specific settings on the appropriate pages.

Page-specific option settings cannot be set as default in the PPD files, but
they can be set by editing the ~/.lpoptions or /etc/cups/lpoptions files.

lp -d foo1 -o PageSize=Letter /etc/motd