Printer

Warning

Some printer manufacturers want to make money buy selling over priced printing cartridges after they got you with an under priced printer. To increase there profit, they add things as a page counter to their system, to refuse printing and to refuse refilling. In the past the cartridges where transparent so it was easy to observe their status, but now they want to restrict that to the user. So first advise don't buy such a printer and if you have one, try to hack it or dump it. For the future I hope this will become illegal due to environmental laws.

However when the printer does not print it could also have an other reason as the inkjet apertures are closed due to dry-ed ink. Wipe it of with a bit of spirituous can make wonders. Finally there are also software problems maybe caused due to updates.

Due to the long history of Unix there is some line printer functions (character printing) but also graphic printing as cups.

Line printer

lpq shows printer jobs

lprm<n> kills printer jobs

Cups

After installing cups, the cups daemon needs to be started:

/etc/init.d/cupsd start

or permanently:

rc-update add cupsd default

then cups can be opened and configured in a (root) web browser http://localhost:631

where you can print test pages.

And if your printer wants to destroy all paper that it finds, it might become out of synchronization with the queue so: /etc/init.d/cupsd stop

To do some administrative tasks as adding a printer you need to login as user root with the root password.

https://www.cups.org/

Install a printer

Using Cups, this is a straight forward task, go to http://localhost:631 and select a printer from the list or (set the ppds use flag) go to http://www.linuxprinting.org and download the ppd file for your printer model.

For HP printers install hplip (if non open source firmware for the particular device is required then also install the hplip-plugin) read https://developers.hp.com/hp-linux-imaging-and-printingand then run hp-setup and finally /etc/init.d/cupsd restart and as regular user hp-toolbox

The hp device manager checks for packages and when missing it ask them to be installed (as avahi, PyQt4).

/usr/share/ppd/HP contains a lot of ppd files that are automatically selectable in cups. In gentoo Linux there is an autostart useflag that puts a desktop file in /etc/xdg/autostart

Cups has a Driver Development kit to create PPD files. I is part of newer cups, but was once separate (cupsddk).

For printers connected locally to the parallel port, make sure the kernel has those modules loaded (either including in the kernel or loaded via /etc/modules.autoload.d/kernel-2.6):

  1. parport

  2. parport_pc

  3. lp

The you should get: /dev/lp0 and within http://localhost:631 you should be able to select lp when adding a new printer.

The configuration is stored in /etc/cups/cupsd.conf and /var/log/cups contains the log.

If root can print, but a normal user not, check for the write access rights of /var/tmp since spool files will be written there.

Print on a printer attached on an other computer

On the server side, the computer that has attached the printer, open http://localhost:631/ and in the Administration tab enable in the Server section "Share printers connected to this system".

On the client side open http://localhost:631/ and add a network printer using the printer queue name of the server: ipp://192.168.1.35:631/printers/Deskjet_F2200. Print a test page using the page and try to print using a regular application.

On the client side type in a console lpstat -v to see the available network printers, as printers using the Internet Printing Protocol (ipp).

Printing encrypted as Android

Encrypted printing hides what gets printed between client and server. This is therefore recommended on open networks.

Create a certificate: openssl req -new -x509 -keyout /etc/cups/ssl/server.key -out /etc/cups/ssl/server.crt -days 3650 -nodes Add

DefaultEncryption Required
ServerCertificate /etc/cups/ssl/server.crt

to /etc/cups/cupsd.conf and restart the cups daemon.

For Android no special app (as Cups Printing or Cups Droid) needs to be installed, in fact everything other than the standard print service might cause trouble. Printers get found when a Web Service Discovery as wsdd are installed, so no printer needs to be added manually.

PDF printers

Some programs have PDF export or a virtual PDF printer functionality that is not part of cups. To have something independently of those programs a virtual cups pdf printer can be installed: emerge cups-pdf. Open http://localhost:631/ and add this printer. Type in something as cupspdf and as description virtual pdf printer. For the device choose cups-pdf and for the model choose the file /usr/share/cups/model/CUPS-PDF.ppd. Per default the pdf files can be found in /var/spool/cups-pdf. This default can be set in /etc/cups/cups-pdf.conf.

Figure 10.3. Cupspdf

Cups pdf


The files got printed to /var/spool/cups-pdf/<user name>. To have a better place, create a symlink ln -s /var/spool/cups-pdf/<user name> ~/cups-pdf

Printing from the command line

Cups can also be used on the command line and understands lots of file formats. This is quite handy when using scripts or to find out why is why I get is not what I see.

See man lp

lpstat -p -d shows what printers I got

lpoptions -p Deskjet_D1600 -l shows what the printer can

lpoptions -d <printer> sets the default printer

lp -d Deskjet_D1600 <filename>.jpg prints it

lp -d Deskjet_D1600 -o page-ranges=1 <filename>.pdf prints first page

lp -d Deskjet_D1600 -o page-ranges=2-3 <filename>.pdf prints page 2 to 3

lp -d Deskjet_D1600 -o fitplot <file>.pdf is the most important command since what you see will also fit to what you get.

Other options -o outputorder=reverse prints last page first so the pile gets on a simple printer ordered

Printer troubleshooting

Since printing involves many packages it is important to find first the package that causes troubles.

  1. troubles just with one printer or with all (try cups-pdf)? If yes check the printer installation.

  2. Is it possible to print from other applications as OOO-Writer, Acrobat-Reader? If yes check the desktop system.

  3. Is it possible to print as root (or other user)? If yes, check permissions.

CUPS Errors

/var/log/cups/error_log might show lots of warnings regarding color management.

The aim of color management is that different medias as screen, beamers, printer scanner appear to have all the same colors.

Since those are warnings they might not harm. ICM ICC files of the color managers are stored in ~/.local/share/icc and /usr/share/color/icc/colord

xiccd is a color daemon. The primary goal of xiccd is providing color profile support for desktop environments other than Gnome and KDE (Xfce, LXDE and probably others) that do not support native color management yet. It has a dependency to colord an other color daemon that is system activated and therefore does not need an init script.


Linurs startpage