SourceForge Logo hpinkjet.sourceforge.net

Hewlett-Packard Co. Inkjet Driver Project

The Hewlett-Packard Inkjet Driver Project is a add-on to the GNU Ghostscript application. This driver is open source software based on the Hewlett Packard Appliance Printing Development Kit APDK for deskjet printers.

Table of contents


1 Overview

The Hewlett-Packard Inkjet Driver Project (HPIJS) is a add-on printer driver for GNU Ghostscript. This driver is open source software based on the Hewlett-Packard Appliance Printing Development Kit APDK for deskjet printers. The driver uses the IJS interface which is a generalized IPC interface for client/server communications. 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 - 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.

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. Postscript is the standard for printing in any Linux or Unix environment.

Ghostscript supports many output devices, including many different printers. This document addresses how to build, install and use HPIJS with Ghostscript. This document is intended for distributions and experienced users. Other users should refer to their appropriate 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 http://www.cs.wisc.edu/~ghost/doc/gnu/index.htm. Together with Ghostscript and HPIJS, PostScript can be converted to a printer language that is compatible with many of the latest HP inkjet products. See Installation on how to download and install HPIJS.

This version of HPIJS supports both the new IJS interface and the old HPIJS interface. Support for the HPIJS interface is provided for backward compatibility only. Most new features will be supported on the IJS interface only. The HPIJS interface is defined in the HPIJS 0.97 release. Information on the IJS interface can be found at inkjet-list.

Ghostscript is not a gui application. Ghostscript is a command line application that runs from a Linux shell, similar to a Microsoft DOS command run from a DOS window.

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. Many Linux distributions all ready support HPIJS in their spooler system, see their web site for spooler support questions. Additional information is available at www.linuxprinting.org.


2 License

GNU Ghostscript uses the GNU General Public License (GPL) and the IJS interface uses the MIT License. After HPIJS 1.0.1 the driver uses a BSD license. HPIJS 1.0 and below uses a BSD type license with a "HP product only" clause.

3 System Requirements

HPIJS works with GNU Ghostscript 6.53 or higher. The HPIJS download includes all the necessary files to build the HP Inkjet Driver from source code. Since the current Ghostscript release now has built-in support for the IJS interface, no other Ghostscript files are necessary to run HPIJS.

HPIJS is platform-independent and works on many different Unix and Linux systems. In order to install HPIJS the download includes an automake/autoconf makefile. This portable build procedure requires an ANSI C compiler, ANSI C++ compiler and a POSIX compliant environment.

This version of HPIJS supports both the new IJS interface and the old HPIJS interface. HPIJS requires Ghostscript to support one of these two interfaces.

Many platforms (Red Hat, Mandrake, SuSE, Yellow Dog, FreeBSD, Debian, HPUX, AIX, etc) have been confirmed to work, please see those sites for more information.


4 Driver Support

There are currently more than 60 HP inkjet printer models supported with HPIJS. HP printer support is defined by the current Hewlett Packard Appliance Printing Development Kit APDK. See the APDK documentation at http://hpapdk.com for more information.

HPIJS supports all the current HP printer models with different Ghostscript command line parameters. Different printer models can be 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.

The following Ghostscript commands are required when using HPIJS.

  -sDEVICE=ijs
  -sIjsServer=hpijs
  -dIjsUseOutputFD
  -sDeviceManufacturer=x   (x equals: "HEWLETT-PACKARD", "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"

      Quality equals: 0=normal (default), 1=draft, 2=best, 3=hires
      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
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 pin and photo pen in printer
Note, there are defaults for all optional commands. PenSet default is defined by each device class.

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 following device descriptions for more details.

4.1 Device Descriptions

HPIJS is a monolithic driver that supports many different printers. Common printers are divided into different device classes. Each device class share common printer attributes such as print modes and paper sizes. HPIJS will automatically map the DeviceModel parameter to one of the devices classes.

The following devices classes are currently supported by HPIJS. Each device class lists the DeviceModel parameter associated with that class. Each device class support 300x300dpi unless specified otherwise.

Note, the DeviceModel parameters listed above for each device class are not the full Model string returned by a IEEE 1284 Device ID query. When HPIJS maps the DeviceModel to a device class, the match is wild-carded and trailing characters are ignored.

For example, a Device ID query on a Deskjet 990Cxi will return "DESKJET 990C". If DeviceModel="DESKJET 990C", HPIJS will match to "DESKJET 99", ignore the "0C" and select the DJ9xxVIP device class. See models.cpp for a list of all model strings and how they are wild-carded.

4.1 Paper Sizes

HPIJS selects the paper size based on the physical paper size determined by Ghostscript. The following paper sizes are supported by HPIJS.
                           inches:      postscript units:
  1. Letter               8.5 x 11        612 x 792
  2. Legal                8.5 x 14        612 x 1008
  3. Ledger                11 x 17        792 x 1224
  4. Executive           7.25 x 10.5      522 x 756
  5. A3                 11.69 x 16.53     842 x 1190
  6. A4                  8.27 x 11.69     595 x 842
  7. A5                  5.83 x 8.27      420 x 595
  8. A6                  4.13 x 5.83      297 x 420 
  9. Photo                  4 x 6         288 x 432 
 10. B4                10.126 x 14.342    729 x 1033 
 11. B5                  7.17 x 10.126    516 x 729
 12. Oufuku-Hagaki       5.83 x 7.87      420 x 567
 13. Hagaki              3.94 x 5.83      284 x 420
 14. Super B               13 x 19        936 x 1368
 15. Flsa                 8.5 x 13        612 x 936

5 Updates


6 Installation

This section addresses how to install or update HPIJS. In most cases this is all you need to do. If your current copy of Ghostscript does not support HPIJS you will need to update Ghostscript.

This section includes instructions for compiling Ghostscript from source code, but this is not an easy task. Before attempting to update Ghostscript, check with your distribution, they may have a Ghostscript update with the latest HPIJS support.

This section does not address how to update your spooler or how to use HPIJS with your spooler. See your distribution about spooler questions. Additional information is available at www.linuxprinting.org.

6.1 HP Inkjet Driver

You can download HPIJS here. The download includes the HPIJS source code and a platform-independent automake/autoconf makefile. After downloading to your directory use the following instructions.
# tar xzvf hpijs-1.0.tar.gz
# cd hpijs-1.0
# ./configure
# make
# make install
You can verify HPIJS was build and installed correctly with the following command.
# hpijs -h

Hewlett-Packard Co. Inkjet Server 1.0
Copyright (c) 2001, Hewlett-Packard Co.
This is all you need to do to install HPIJS. If your current Ghostscript supports the IJS or HPIJS interface you are done. If you are not sure the Ghostscript Install section will show you how to verify IJS or HPIJS interface support.

6.2 Ghostscript

Your current Ghostscript may already support HPIJS. You can verify this with the gs -h command. You should see output similar to this.

GNU Ghostscript 6.53 (2002-02-13)
Copyright (C) 2002 artofcode LLC, Benicia, CA. All rights reserved.
Usage: gs [switches] [file1.ps file2.ps ...]
Most frequently used switches: (you can use # in place of =)
 -dNOPAUSE           no pause after page   | -q       `quiet', fewer messages
 -gx  page size in pixels   | -r  pixels/inch resolution
 -sDEVICE=  select device         | -dBATCH  exit after last file
 -sOutputFile= select output file: - for stdout, |command for pipe,
                                         embed %d or %ld for page #
Input formats: PostScript PostScriptLevel1 PostScriptLevel2 PDF
Available devices:
   x11 bbox x11alpha x11cmyk x11gray2 x11gray4 x11mono bmpmono bmpgray
   bmpsep1 bmpsep8 bmp16 bmp256 bmp16m bmp32b deskjet djet500 laserjet
   ljetplus ljet2p ljet3 ljet3d ljet4 ljet4d lj5mono lj5gray cdeskjet
   cdjcolor cdjmono cdj550 pj pjxl pjxl300 uniprint ijs hpijs DJ630
   DJ6xx DJ6xxP DJ8xx DJ9xx DJ9xxVIP AP21xx bj10e bj200 bjc600
   bjc800 faxg3 faxg32d faxg4 pcxmono pcxgray pcx16 pcx256 pcx24b pcxcmyk
   pbm pbmraw pgm pgmraw pgnm pgnmraw pnm pnmraw ppm ppmraw pkm pkmraw pksm
   pksmraw tiffcrle tiffg3 tiffg32d tiffg4 tifflzw tiffpack tiff12nc
   tiff24nc psmono psgray psrgb bit bitrgb bitcmyk png16m pnggray pngmono
   png256 png16 jpeg jpeggray pdfwrite pswrite epswrite pxlmono pxlcolor
   cljet5 cljet5c nullpage
Search path:
   . : /usr/share/ghostscript/6.53/lib : /usr/share/ghostscript/fonts
For more information, see /usr/share/ghostscript/6.53/doc/Use.htm.
Report bugs to bug-gs@ghostscript.com, using the form in Bug-form.htm.
If you don't see any of the above highlighted devices your version of Ghostscript does not have built-in support for HPIJS.

The ijs device supports the IJS interface. All other devices (hpijs DJ630 DJ6xx DJ6xxP DJ8xx DJ9xx DJ9xxVIP AP21xx) are supported through the old HPIJS interface. Both interfaces are supported by HPIJS, but the IJS interface replaces the old HPIJS interface.

If Ghostscipt does not support HPIJS, check with your distribution and see if they have a Ghostsript update.

If necessary, the following instructions show you how to build GNU Ghostscipt 6.53. GNU Ghostscript 6.53 or higher will have built-in support for the IJS interface.

  1. Download the source code for gs, jpeg, png and zlib into the following directories respectfully. See the GNU Ghostscript documentation for more information. You can create this directory structure in your user directory. Be sure to use the following directory names for jpeg, libpng and zlib.
    ../gs6.53/
    ../gs6.53/jpeg/
    ../gs6.53/libpng/
    ../gs6.53/zlib/
    
  2. Ghostscript looks for fonts in hardcoded directories, see GS_LIB_DEFAULT in the makefile. For RH6.2 and RH7 the following symbolic link will allow Ghostscript to find fonts with out modifying the makefile. Other distributions may have different font directories.

    # ln -s /usr/share/fonts/default/Type1 /usr/share/ghostscript/fonts
    
  3. Now build and install Ghostscript by running the following commands in the Ghostscript directory.
    # ./configure prefix=/usr
    # make
    # make install
    
  4. Now run the gs -h command, you should see the ijs device name.

6.3 PrintTool

If you use PrintTool (ie: RH6.2 and RH7) and you want PrintTool to recognize the new ijs device add the following lines to /usr/lib/rhs/rhs-printfilters/printerdb file.
StartEntry: IJS
  GSDriver: ijs
  Description: {IJS Client}
  About: { \
           This is a generalized IJS client interface for ghostscript printer \
           drivers. Different drivers and options are specified in the \
           "Extra GS options" box. The following ghostscript commands are used by the \
           HP Inkjet Driver (HPIJS): -sIjsServer=hpijs, \
           -sDeviceManufacturer="HEWLETT-PACKARD", \
           -dIjsUseOutputFD, -sDeviceModel=model, -dDuplex, -dTumble, -sIjsParams=options. \
           Where DeviceModel equals one of the following: "DESKJET 990", "DESKJET 970", etc... \
           -dDuplex equals book, -dDuplex -dTumble equals tablet. \
           IjsParams can be any of the following: Quality=n, MediaType=n, ColorMode=n, PenSet=n. \
           Where Quality equals one of the following: 0=normal (default), 1=draft, 2=best. \
           MediaType equals one of the following: 0=plain (default), 1=premium, 2=photo. \
           ColorMode equals one of the following: 0=grey_k, 1=grey_cmy, 2=color (default). \
           PenSet equals one of the following:  0=black_pen, 1=color_pen, 2=both_pens, \
           3=mdl_pen, 4=mdl_both. \
           Not all combinations of Quality, MediaType and ColorMode are valid print modes. \
           Resolution setting 600x600 is available for some print modes only. \
           In printtool special characters must be preceded by a double backslash see the \ 
           following example for HP 990C: -sIjsServer=hpijs -sDeviceManufacturer=\\"HEWLETT-PACKARD\\" \
           -dIjsUseOutputFD -sDeviceModel=\\"DESKJET 990C\\". \ 
         }
  Resolution: {300} {300} {}
  Resolution: {600} {600} {}
EndEntry
In PrintTool special characters must be preceded by a double backslash (see example above). Note, PrintTool has a problem with double backslash. PrintTool allows you to set double backslash, but it will only read one backslash back when editing. This means if you are editing the Extra GS options you must re-enter the double backslash.


7 Usage

7.1 Spooler Example

The following command will print a postscript file to the lp0 spooler.

$ lpr -Plp0 tiger.ps

Most applications use the lpr command to print documents.

7.2 Ghostscript Example

Here is a Ghostscript example using our driver on a 990C deskjet from the command line. This command bye passes the spooler and prints directly to the printer. You must be logged in as root in order direct the output directly to /dev/lp0.
$ gs -sDEVICE=ijs -sIjsServer=hpijs -dIjsUseOutputFD -sDeviceManufacturer="HEWLETT-PACKARD" -sDeviceModel="DESKJET 990" -r300 -dNOPAUSE -dSAFER -sOutputFile="/dev/lp0" file.ps -c quit
This command line example shows how to print a 4x6 inch photo from a digital camera.
$ convert -rotate 90 p8160010.jpg p8160010.png
$ convert -page 324x432-18+0 p8160010.png photo.ps
$ gs -sDEVICE=ijs -sIjsServer=hpijs -dIjsUseOutputFD -sDeviceManufacturer="HEWLETT-PACKARD" -sDeviceModel="DESKJET 990" -r300 -dNOPAUSE -dSAFER -sOutputFile="/dev/lp0" -dDEVICEWIDTHPOINTS=288 -dDEVICEHEIGHTPOINTS=432 photo.ps -c quit
The first command rotates the picture 90 degrees and converts from jpg to png. The second command converts the png to postscript and scales the image to 4.5x6 inches. The original photo was 1280x960 pixels. In order to keep the same aspect ratio as the original photo, the second command scales to 4.5x6 instead of 4x6 inches. The means we need to clip the top and bottom (x axis) by 0.25 inches. Ghostscript parameters DEVICEWIDTHPOINTS=288 and DEVICEHEIGHTPOINTS=432 specify the actual paper size in postscript units, which in this case represents 4x6 inches (288=4*72, 432=6*72).

Similar to the above example, here is a 4x6 full bleed (borderless) photo printing example using the Photosmart 100.

$ convert -rotate 90 p8160010.jpg p8160010.png
$ convert -page 324x432-18+0 p8160010.png photo.ps
$ gs -sDEVICE=ijs -sIjsServer=hpijs -dIjsUseOutputFD -sDeviceManufacturer="HEWLETT-PACKARD" -sDeviceModel="PHOTOSMART 100" -r600 -sIjsParams="Quality:FullBleed=1" -dNOPAUSE -dSAFER -sOutputFile="/dev/usb/lp0" -dDEVICEWIDTHPOINTS=288 -dDEVICEHEIGHTPOINTS=432 photo.ps -c quit


David Suffield
© 2001-2002 Hewlett-Packard Company
Last updated May 1, 2002