CUPS

Installation

 * 1) emerge cups

Web Interface
Setup web interface in /etc/cupsd.conf

Port 631  Order Deny,Allow Deny From All Allow From 127.0.0.1 Allow From 10.1.1.0/24   AuthType Basic AuthClass System Order Deny,Allow Deny From All Allow From 127.0.0.1 Allow From 10.1.1.0/24 

and then use web interface on http://localhost:631.

HP1022n
Looked up printer in linuxprinting.org, and found that foo2zjs was the recommended driver. Checked the package database: eix foo2zjs * net-print/foo2zjs Available versions: 20060607 Installed:          20060607 Homepage:           http://foo2zjs.rkkda.com/ Description:        Support for printing to ZjStream-based printers and did a: echo "net-print/foo2zjs ~x86" >> /etc/portage/package.keywords emerge foo2zjs then installed the printer using the CUPS web interface:
 * 1) Printers
 * 2) Add Printer
 * 3) Name: 'hp1022n', Description: 'HP LaserJet 1022n'
 * 4) Device: 'LPD/LPR Host or Printer' (the only one that worked for me)
 * 5) Device URI: 'socket://10.1.1.8:9100'
 * 6) Make: 'HP'
 * 7) Model: 'HP LaserJet 1022 Foomatic/foo2zjs (recommended) (en)'

Client Configuration
Set ~/.lpoptions: Default hp1022n page-left=19 cpi=13 lpi=7 prettyprint=true media=A4 page-top=30 page-bottom=24

Print using these commands:

lpr somefile.pdf lp -P 1-3 somefile.pdf # page 1,2,3

On other machines on network, set CUPS server in .bashrc:

export CUPS_SERVER=xxx.yyy.zzz.xxx

Printing From Linux to Windows Shared Printer
First, you need to share the printer. Make sure the sharename is one word, like 'laser'.

Try to find it with the Samba client:

Domain=[LINNE] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]
 * 1) smbclient -L windows_box -N

Sharename      Type      Comment -            ---        shared          Disk laser          Printer   HP LaserJet 4L   <- there it is! ... Domain=[WINDOWS_BOX] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager] ...

Then you need to find a suitable .ppd-file on http://www.linuxprinting.org/printer_list.cgi


 * 1) cp some_driver.ppd /usr/share/cups/model/
 * 2) lpadmin -p laser -v smb://windows_box/laser -P /usr/share/cups/model/some_driver.ppd  <- add printer
 * 3) /usr/bin/enable laserjet   <- start printer
 * 4) accept laserjet            <- accept print jobs
 * 5) lpadmin -d laser           <- make it the default printer

Examples
./configurationCount.py|lpr -Pe21a -olandscape