hpinkjet.sourceforge.net

# Hewlett-Packard Co. Linux Inkjet Driver Project

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

## Table of contents

- 1 Overview
- 2 License
- 3 System Requirements
- 4 Driver Support
- 5 Updates
- 6 Ghostscript Installation
  - 6.1 Source Code
  - 6.2 Standard Binary RPMs
- 7 Spooler Installation
- 8 Usage
  - 8.1 Spooler Example
  - 8.2 Ghostscript Example
- 9 Project Development

## 1 Overview

The Hewlett-Packard Linux Inkjet Driver Project is a add-on to GNU Ghostscript. This driver is based on the Hewlett-Packard Appliance Printing Development Kit APDK for deskjet printers. There are two parts to the HP Inkjet Driver - glue code that resides in GNU Ghostscript and APDK server. The APDK runs as a server or coprocess to GNU Ghostscript. The server is spawned automatically by GNU Ghostscript. This document will refer to the APDK server as the HP Inkjet Server (HPIJS). The following figure is a high level overview of the interface between GNU Ghostscript and the HP Inkjet Server.

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 add the Hewlett-Packard Inkjet Driver to the current GNU Ghostscript and how to use it.

The Hewlett-Packard Inkjet Driver is just another printer driver added to GNU Ghostscript. 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 the Inkjet Driver, PostScript can be converted to PCL that is compatible with many of the latest HP inkjet products. See Ghostscript Installation on how to download and install Ghostscript for the Inkjet Driver.

GNU 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.

GNU 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 use a gui application to configure a print spooler such as PrintTool or CUPS. See Spooler Installation on how to install a print spooler using PrintTool for Hewlett Packard supported printers. Information on using CUPS is available at www.cups.org and www.linuxprinting.org.

## 2 License

GNU Ghostscript uses the GNU General Public License (GPL) and the glue code uses the GNU Lesser General Public License (LGPL). The HP Inkjet Server has a BSD license with a "HP product only" clause.

## 3 System Requirements

The Hewlett-Packard Linux Inkjet Driver requires GNU Ghostscript version 5.50 or higher. GNU Ghostscript is platform-independent and works on many different systems - Unix, Linux, Windows, OS/2 etc. The driver was developed and tested with GNU Ghostscript 5.50 running with Redhat 6.2 and 7.0.

## 4 Driver Support

There are currently 41 HP inkjet printer models supported with the GNU Ghostscript/HP Inkjet Server (GS/HPIJS) combination. 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.

GS/HPIJS supports all the current HP printer models with different command line parameters. The following commands are required when using GS/HPIJS.

      -sDEVICE=hpijs
      -sDeviceName=x
         where x equals: DJ350, DJ630, DJ6xx, DJ6xxP, DJ8xx, DJ9xx or DJ9xxVIP

GS/HPIJS also has a "-dPrintMode" command for setting the print mode. This command can be used to set grayscale, normal or photo print modes. With no print mode specified the default is normal. See the following printer driver descriptions for more details.

GS/HPIJS can be used by itself to print to a HP printer, but generally a print spooler must be used. The print spooler must be configured to use Ghostscript when printing to a HP printer. Many Linux distributions use a gui application to configure a print spooler such as PrintTool or CUPS. This document will refer to PrintTool when configuring a spooler, but other applications can be used. Information on using CUPS is available at www.cups.org and www.linuxprinting.org.

PrintTool allows the "root" user to create a print spooler for a specified printer. PrintTool configures the print spooler with script files that pass the proper command line parameters to GS/HPIJS.

With PrintTool you can configure GS/HPIJS to use the following HP printers.

- HP - developed DeskJet 350 series (DJ350) - This driver was specifically developed by Hewlett-Packard Co. to optimize the speed and print quality of the HP DeskJet 350 for use in Linux operating systems. Different print modes can be specified with the Extra GS option "-dPrintMode=n". Where n equals one of the following values: 0=grayscale, or 1=normal (default).

- HP - developed DeskJet 630C series (DJ630) - This driver was specifically developed by Hewlett-Packard Co. to optimize the speed and print quality of the HP DeskJet 630/632C for use in Linux operating systems. Different print modes can be specified with the Extra GS option "-dPrintMode=n". Where n equals one of the following values: 0=grayscale, 1=color, 2=normal (default) or 3=photo.

- HP - developed DeskJet 600C series (DJ6xx) - This driver (DJ6xx) was specifically developed by Hewlett-Packard Co. to optimize the speed and print quality of the HP DeskJet 600, 660C, 670/672C, 670TV, 680/682C, e20 for use in Linux operating systems. Different print modes can be specified with the Extra GS option "-dPrintMode=n". Where n equals one of the following values: 0=grayscale, or 1=normal (default).

- HP - developed DeskJet 600C series photo (DJ6xxP) - This driver was specifically developed by Hewlett-Packard Co. to optimize the speed and print quality of the HP DeskJet 610/612C, 640/648C, 690/692/693/694/695/697C for use in Linux operating systems. Different print modes can be specified with the Extra GS option "-dPrintMode=n". Where n equals one of the following values: 0=grayscale, 1=normal (default), or 2=photo.

- HP - developed DeskJet 800C series (DJ8xx) - This driver was specifically developed by Hewlett-Packard Co. to optimize the speed and print quality of the HP DeskJet 810/812/815/816C, 830/832C, 840/842C, 880/882C, 895C for use in Linux operating systems. Different print modes can be specified with the Extra GS option "-dPrintMode=n". Where n equals one of the following values: 0=grayscale, 1=normal (default), 2=photo, or 3=draft. Resolution setting 600x600 is available for photo mode only.

- HP - developed DeskJet 900C series (DJ9xx) - This driver was specifically developed by Hewlett-Packard Co. to optimize the speed and print quality of the HP DeskJet 930/932C, 950/952C, 970C, Photosmart 1000/1100 for use in Linux operating systems. Duplex printing is not supported. Different print modes can be specified with the Extra GS option "-dPrintMode=n". Where n equals one of the following values: 0=grayscale, 1=normal (default), or 2=photo. Resolution setting 600x600 is available for photo mode only.

- HP - developed DeskJet 990C (DJ9xxVIP) - This driver was specifically developed by Hewlett-Packard Co. to optimize the speed and print quality of the HP DeskJet 960C, 980C, 990C, Photosmart 1215/1218 for use in Linux operating systems. Duplex printing is not supported. Different print modes can be specified with the Extra GS option "-dPrintMode=n". Where n equals one of the following values: 0=grayscale, or 1=normal (default). Resolution setting 600x600 is available for normal mode only.

## 5 Updates

- HPIJS 0.97 - Made some bug fixes to the APDK 2.4 code and changed the top margin settings in gdevhpij.c back to a value that is compatible with existing printer drivers.

  This update fixes some of the following problems.

         1. A line of text near the top of the page would not print.
         2. Top and bottom margins on multiple page jobs was not consistent.

- HPIJS 0.96 - Updated the HPIJS server to APDK 2.4 which adds support for the following printers.

         DeskJet980
         DeskJet960
         DeskJet350
         Photosmart 1000/1100
         Photosmart 1215/1218

  Made a small change to the top and right margins in gdevhpij.c. This corrects a problem where both ghostscript and HPIJS were trying to set the margins.

  Added some query commands to the GS/HPIJS communication interface. These commands can be used to return current printer parameters.

  This release is backward compatible with HPIJS 0.95.

- HPIJS 0.95 - Fixed a scaling problem with device-dependent postscript using CUPS. This was a problem with DJ630, DJ6xxP and DJ8xx photo mode only. This was not a problem printing device-independent postscript.

  Changed ghostscript command interface to HPIJS driver. The HPIJS driver is now called with the following ghostscript commands.

         -sDEVICE=hpijs
         -sDeviceName=x
            where x equals: DJ630, DJ6xx, DJ6xxP, DJ8xx, DJ9xx or DJ9xxVIP

  This removes the hard coded device parameters from gdevhpij.c so new printer drivers can be added to HPIJS with out re-compiling ghostscript.

  The old interface used the following ghostscript commands.

         -sDEVICE=x
            where x equals: DJ630, DJ6xx, DJ6xxP, DJ8xx, DJ9xx or DJ9xxVIP

  The old interface is degraded and will eventually be dropped. New printer drivers will not use the old interface.

- HPIJS 0.94 - Minor changes where made to the add-on files for ghostscript. No functional changes or bug fixes. Changed gdevhpijs.c to gdevhpij.c (8.3 ghostscript convention). Moved defines from models.h and hpijs.h to new gdevhpij.h. The gdevhpij.h file is LGPL.

- HPIJS 0.93 - Initial release.

## 6 Ghostscript Installation

#### 6.1 Source Code

The following instructions are for Redhat 6.2 and Redhat 7.0. Since, both Redhat distributions use GNU Ghostscript 5.50, a full install of GNU Ghostscript 5.50 is not necessary and the original copy will be overwritten.

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.

       ../gs/gs5.50/
       ../gs/gs5.50/jpeg/
       ../gs/gs5.50/libpng/
       ../gs/gs5.50/zlib/

2. Download the source code for the HP InkJet Server files here and put them in the following directory.

       ../gs/hpijs/

3. Copy the following files from ../gs/hpijs/ to the ../gs/gs5.50/ directory.

       gdevhpij.c
       gdevhpij.h
       contrib.mak
       unix-gcc.mak

4. Now build GS/HPIJS by running the make command in each of the following directories.

       # ../gs/gs5.50/make
       # ../gs/hpijs/make

5. With the following commands you can make GS/HPIJS the default gs command.

       # cp ../gs/gs5.50/obj/gs /usr/bin/
       # cp ../gs/hpijs/hpijs /usr/bin/

6. You can verify GS/HPIJS was build correctly with the gs -h command. You should see output similar to this.

       GNU Ghostscript 5.50 (2000-2-13)
       Copyright (C) 1998 Aladdin Enterprises, Menlo Park, 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 x11alpha x11cmyk x11gray2 x11gray4 x11mono hpijs DJ630 DJ6xx DJ6xxP
          DJ8xx DJ9xx DJ9xxVIP AP21xx deskjet djet500 laserjet ljetplus ljet2p
          ljet3 ljet4 cdeskjet cdjcolor cdjmono cdj550 pj pjxl pjxl300 uniprint
          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 tiffcrle tiffg3 tiffg32d tiffg4 tifflzw tiffpack
          tiff12nc tiff24nc psmono psgray psrgb bit bitrgb bitcmyk pngmono pnggray
          png16png256 png16m jpeg jpeggray pdfwrite bbox pswrite epswrite pxlmono
          pxlcolor nullpage
       Search path:
          . : /usr/share/ghostscript/5.50 : /usr/share/fonts/default/ghostscript :
          /usr/share/fonts/default/Type1
       For more information, see /usr/share/ghostscript/5.50/doc/Use.htm.
       Report bugs to ghost@aladdin.com, using the form in Bug-form.htm.

7. In order to use PrintTool with GS/HPIJS you must append the printerdb_append file with /usr/lib/rhs/rhs-printfilters/printerdb. This will allow you to select the HP printers supported by GS/HPIJS. You can use the following shell script for Redhat 6.2 and Redhat 7.0.

       # sh append_db.sh

You should now have the GS/HPIJS built and ready to run as the default gs command. See Spooler Installation on how to install a print spooler.

For different Linux distributions you will have to modify the unix-gcc.mak file that comes with the HP InkJet Server distribution. The following changes were made to unix-gcc.mak for Redhat 6.2 and Redhat 7.0. Other distributions will have different defines.

    prefix = /usr
    GS_LIB_DEFAULT=$(gsdatadir):$(datadir)/fonts/default/ghostscript:$(datadir)/fonts/default/Type1
    XLIBDIRS=-L/usr/X11R6/lib

#### 6.2 Standard Binary RPMs

You will need two RPMs for GS/HPIJS, download the appropriate RPMs for your distribution.

- Redhat 7.0 hpijs
- Redhat 7.0 ghostscript-hpijs
- Redhat 6.2 hpijs
- Redhat 6.2 ghostscript-hpijs

After downloading use the following example commands to install the RPMs. Note, this will overwrite your original copy of Ghostscript.

    # rpm -ivh hpijs-0.96-1.rh62.i386.rpm
    # rpm -ivh --force ghostscript-hpijs-5.50-4.rh62.i386.rpm

## 7 Spooler Installation

The following installation instructions are for Redhat 6.2 and Redhat 7.0. In order to install a print spooler for GS/HPIJS you must be logged in as root. Then start the printtool program.

You should see the following PrintTool window. PrintTool already has two print spools installed - lp8 and lp. These spoolers are based on reversed engineered HP printer drivers. We are going to add our own HP printer driver.

Click on the Add button.

Click OK to install a local printer.

This window shows the local device /dev/lp0 was detected - click OK.

The name of our spooler will be lp0 - click Select.

This window displays all printer devices supported by PrintTool. We will select the HP - developed DeskJet 900C series - click OK, OK.

Use the lpd menu to restart the lpd daemon so that the spool entry will be recognized. We are now done - exit PrintTool.

## 8 Usage

#### 8.1 Spooler Example

The user can use the new spooler created in our installation example above by specifying lp0 as the print spool. The following command will print a postscript file to the lp0 spooler.

    $ lpr -Plp0 tiger.ps

Most Linux applications use the lpr command to print documents. If you do not specify which spooler to print to, the lpr command will default to the first spooler entry in PrintTool. In our installation example above this would be lp8. The following command would default to lp8.

    $ lpr tiger.ps

Make lp0 the first entry in PrintTool if you want it to be the default spooler.

#### 8.2 Ghostscript Example

Here is a gs 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=hpijs -sDeviceName=DJ9xx -r300x300 -dPrintMode=1 -dNOPAUSE -dSAFER -sOutputFile="/dev/lp0" file.ps -c quit

David Suffield
© 2001 Hewlett-Packard Company
Last updated June 7, 2001