Xprint Setup for Debian

First confirm you have the needed packages installed:
  $ dpkg --get-selections xprt\* cupsys\*
  xprt-common					install
  xprt-xprintorg				install
  cupsys					install
  cupsys-bsd					install
  cupsys-client					install
  cupsys-driver-gimpprint			install
  cupsys-driver-gimpprint-data			install
  cupsys-pt					install
Then, configure all your printers in CUPS. (Start by pointing your browser at http://localhost:631, finish by printing test pages). If you run into trouble, check out http://www.linuxprinting.org/.

Confirm CUPS is running and your printers are configured:

  $ lpstat -a
  HP6122 accepting requests since Jan 01 00:00
  LaserJet-6P accepting requests since Jan 01 00:00
  PDF-Writer accepting requests since Jan 01 00:00
Restart xprint:
  # /etc/init.d/xprint restart
You probably remember that an X client program uses the environment variable DISPLAY to indicate which "screen" to send data to. That screen is connected to a "video" X-Server. Xprint implements an additional "print" X-Server, connected to a different screen, indicated by an additional environment variable. (On my Debian system, the variable is set in /etc/X11/Xsession.d/92xprint-xpserverlist.) Check that the variable is set:
  $ set|grep XP
  XPSERVERLIST=':64 '
Confirm that xprint found the CUPS printers:
  $ xplsprinters
  printer: PDF-Writer@:64
  printer: LaserJet-6P@:64
  printer: HP6122@:64
  printer: xp_ps_spooldir_HOME_Xprintjobs@:64
  printer: xp_pdf_spooldir_HOME_Xprintjobs@:64
In my case, the second and third lines are for my real printers. Note: if you try this in a virtual console, XPSERVERLIST won't be set, and you'll get this:
  $ xplsprinters
  xplsprinters:  no printers found for printer spec "".
You can use one of the xprint programs to send a rudimentary test page to a printer:
  $ xphelloworld -printer LaserJet-6P
However, the more critical test is to start mozilla or firefox, visit a small page, and print it. Then navigate to "file | print preview", and compare the printout with the display.

One common problem is that the printout is larger (e.g. text extends beyond the page) or smaller (e.g. only uses the top left corner of the page) than the browser intended. The problem here is that the printer's resolution doesn't match what xprint expects. First, check what xprint expects:

  $ xplsprinters -p LaserJet-6P -l | egrep '(printer|resolution)'
  printer: LaserJet-6P@:64
  	default-printer-resolution=600
  	resolution=600
  	resolution=360
  	resolution=400
  	resolution=300
The "default-printer-resolution" is the key. It comes from this line in /etc/Xprint/C/print/attributes/document
  *default-printer-resolution: 600
My firefox printouts were too big. The simplest way to fix that would be to change "600" to "300" in this line. However, my printer's documentation claims a resolution of 600 dpi. What's going on?

It turns out there's one more variable: CUPS can instruct a printer to use one of several print modes. If you visit http://localhost:631/printers and click on the "configure printer" link for a given printer, you can see the resolution and print mode options. In my case, the resolution was "controlled by printer mode", and the mode was "normal" (i.e. 300 dpi). I changed the latter to "high quality" to get 600 dpi. You can also get and set these options from the command line:

  $ lpoptions -p LaserJet-6P -l
  REt/REt Setting: Dark Light *Medium Off
  TonerDensity/Toner Density: 1 2 *3 4 5
  Duplex/Double-Sided Printing: DuplexNoTumble DuplexTumble *None
  Manualfeed/Manual Feed of Paper: Off On
  InputSlot/Media Source: Default Upper *Lower Envelope LargeCapacity Manual MPTray Auto
  Copies/Number of Copies: *1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
  PageSize/Page Size: Custom *Letter A4 Photo 3x5 5x8 A5 A6 B5JIS Env10 EnvC5 EnvC6 EnvDL EnvISOB5 EnvMonarch Executive FLSA Hagaki Legal Oufuku w558h774 w612h935
  PageRegion/PageRegion: Letter A4 Photo 3x5 5x8 A5 A6 B5JIS Env10 EnvC5 EnvC6 EnvDL EnvISOB5 EnvMonarch Executive FLSA Hagaki Legal Oufuku w558h774 w612h935
  PrintoutMode/Printout Mode: Draft Normal *High
  Economode/Toner Saving: *Off On
  MPTray/MP Tray: Cassette *First
  Quality/Resolution, Quality, Ink Type, Media Type: *FromPrintoutMode 300DraftGrayscaleK 300GrayscaleK 600GrayscaleK
Note: If instead of "xprt-xprintorg" and "xprt-common", you have the more recent packages "xprint" and "xprint-common" installed, you can use the command "dpkg-reconfigure xprint-common" to change the default resolution.

However, what if you have printers with different resolutions, so the same "default-printer-resolution" setting can't be used for all of them? In that case, you need to create custom printers as follows:

  # cd /usr/share/Xprint/xserver/C/print/models
  # mkdir lj6
  # ln -s PSdefault/fonts lj6
  # cp PSdefault/model-config lj6
Then edit lj6/model-config:
  *descriptor: HP LaserJet 6P			(change)
  *printer-model "LaserJet 6P"			(change)
  *plexes-supported: simplex 			(change)
  *printer-resolutions-supported: 300 600	(change)
  *default-printer-resolution: 600		(add)
Finally, edit /opt/GISWxprintglue/server/etc/XpConfig/C/print/attributes/printer and add the following line:
    LaserJet-6P.xp-model-identifier: lj6
The syntax for this line is PRINTER_NAME.xp-model-identifier:DIRECTORY_NAME where PRINTER_NAME would be the name you typed everywhere above and DIRECTORY_NAME is the name you typed in for the mkdir command one paragraph above. You could keep them the same for simplicity.

More Printer Configuration

To set up GIMP, first install the Gimp-Print plug-in. You can then configure a printer using the print dialog. Click into the window with your image using the right mouse button and choose "File" and "Print". In the printing dialog choose your printer queue (if it is not listed, click "New Printer ..." to create a list entry) and click on "Setup Printer ...". If your printer is listed, then it is supported by Gimp-Print and you do not need a PPD file to use it with GIMP. If it is not listed, choose "Printer Make" of "Adobe" and "Printer Model" of "PostScript Level 2". Then an input field for a PPD file will appear. Enter the path and name under which you have saved your PPD file (e.g. /etc/cups/ppd/LaserJet-6P.ppd) or choose it with the "Browse" button. Adapt the printing command to your spooler, especially remove the "-oraw" option, because it is important that print jobs for non-PostScript printers are going through the filters of the print queue. After closing the dialog with "OK" the fields for the options ("Media Size", "Media Source", ...) will contain the choices according to your printer. Click "Save Settings" to make your setup permanent.

I didn't see a tool in GIMP to remove a printer configuration. I think you have to edit ~/.gimp-2.2/printrc and remove a stanza.

Check http://www.linuxprinting.org/ppd-doc.html for setting up some other applications for printing. For what it's worth, I didn't have to do anything specific to get OpenOffice to print.

Open Issues

After the above, I am left with these configuration problems unsolved:

Acknowledgements

Some of this was adapted from the very helpful paper "Using Gimp-Print, CUPS, Ghostscript and Xprint on Solaris 8" by Cory Petkovsek. For more on Xprint, see the Xprint FAQ. The GIMP discussion was adapted from the above page at http://www.linuxprinting.org.


Last modified: 2006-03-23

Valid HTML 4.01!

Valid CSS!