Technical Documentation: Printer Driver

The HP Inkjet Driver (HPIJS) is an add-on printer driver for GNU Ghostscript. This driver is open source software that supports HP InkJet and LaserJet printers. The driver takes RGB rasters from Ghostscript and converts them to printer-ready-bits.

(HPIJS is based on the HP Appliance Printing Development Kit (APDK) at http://www.hpdevelopersolutions.com.)

Ghostscript uses a generalized IPC interface for HPIJS communications. This interface is called the IJS interface. The IJS interface, which was written by Raph Levien of Ghostscript, was inspired by the first HPIJS interface. The IJS interface can be used by any printer manufacturer.

There are two parts to the IJS interface - the IJS client that resides in GNU Ghostscript and the IJS server. The IJS server is built into the printer driver, in our case the HP InkJet driver. In this document the term IJS server, HPIJS server, HPIJS, or HP Inkjet Driver are all synonymous. They all refer to the same software component. HPIJS runs as a server or co-process to GNU Ghostscript. The server is spawned automatically by GNU Ghostscript. The following figure is a high level overview of the IJS interface between GNU Ghostscript and HPIJS.

gs/hpijs diagram

GNU Ghostscript is a software application that interprets PostScript and displays the results on the screen or converts the PostScript into a form you can print on a non-PostScript printer.

PostScript is a programming language optimized for printing graphics and text. It is sometimes called a page description language. Most Linux applications support PostScript, which is the standard for printing in any Linux or Unix environment.

Ghostscript supports many output devices, including many different printers. This document only addresses HPIJS with Ghostscript. This document is intended for distributions and experienced users. Other users should refer to their Linux distribution for HPIJS support.

Although HPIJS runs as a separate process from Ghostscript, HPIJS still looks like just another Ghostscript printer driver. Adding printer drivers is a well documented interface that is described in the GNU Ghostscript documentation at www.ghostscript.com. Together with Ghostscript and HPIJS, PostScript can be converted to a printer language that is compatible with many of the latest HP printer products.

HPIJS supports the IJS interface. More information on the IJS interface can be found at http://www.linuxprinting.org/ijs/.

Ghostscript is a command line application that runs from a Linux shell. Ghostscript can be used by itself to print to a non-PostScript printer, but generally a print spooler must be used. The print spooler must be configured to use Ghostscript when printing to a non-PostScript printer. Most Linux distributions already support HPIJS in their spooler system. See their website for spooler support questions. Additional information is available at www.linuxprinting.org.

HPIJS provides no I/O. HPIJS emits a standard file output. The output can be directed to a file or to the actual device via the parallel or USB port. This "raw" printing does not require bi-directional I/O. Some all-in-one devices do not support "raw" I/O and must use HPLIP for printing (specifically the OfficeJet K80). In this case HPIJS output is sent to the "hp" CUPS backend, the backend opens an 1284.4/MLC print channel, then the data is passed to the actual device.

HPIJS supports all the current HP printer models with different Ghostscript command line parameters. Different printer models are selected with the IEEE 1284 Manufacturer and Model strings. This information can come from the query of a printer over the parallel or USB port. Common printer models are divided into different device classes. Each device class shares common printer attributes such as print modes and paper sizes. HPIJS will automatically map the printer model to a specific device class.

The following Ghostscript commands are required when using HPIJS.

-sDEVICE=ijs
-sIjsServer=hpijs
-dIjsUseOutputFD
-sDeviceManufacturer=x   (x equals: "HEWLETT-PACKARD", "HP", "APOLLO")
-sDeviceModel=x          (x equals: "DESKJET 990", "DESKJET 670", etc...)

The following Ghostscript commands are optional when using HPIJS.

-dDuplex=false -dTumble=false (none)
-dDuplex=true  -dTumble=false (book)
-dDuplex=true  -dTumble=true  (tablet)
-sIjsParams="Quality:Quality=n,Quality:ColorMode=n,Quality:MediaType=n,
Quality:PenSet=n,Quality:FullBleed=n,PS:MediaPosition=n"
Quality equals: 0=normal (default), 1=draft, 2=best, 3=hires, 4=fastdraft
ColorMode equals: 0=grey_k, 1=grey_cmy, 2=color (default)
MediaType equals: 0=plain (default), 1=premium, 2=photo
PenSet equals: 0=black_pen, 1=color_pen, 2=both_pens, 3=mdl_pen, 4=mdl_both
FullBleed equals: 0=no (default), 1=yes
MediaPosition equals: 1=upper_tray, 4=lower_tray, 7=autoselect (default)

PenSet Definitions

black_pen: only black pen in the printer
color_pen: only color pen in the printer
both_pens: black & color pens in printer
mdl_pen: photo pen in the printer
mdl_both: color pen and photo pen in printer

Caveats

  1. Note, there are defaults for all optional commands. PenSet default is defined by each device class.
  2. The Quality, MediaType, ColorMode, PenSet and FullBleed are used to set the print mode. Not all combinations of Quality, MediaType, ColorMode, PenSet and FullBleed are valid print modes. If an invalid print mode is set, the job will still print, because HPIJS will default to a print mode that makes sense given the input. HPIJS will send any error message to stderr and syslog. Print modes are device class specific. See the Printer Device Classes descriptions for more details.
  3. MediaPosition can be any valid PCL Media Source value. MediaPositon defaults to "autoselect" which means the printer will decide which tray to use. MediaPosition is recognized by DJ9xxVIP, DJGenericVIP and HP LaserJet only. All other device classes ignore this command.