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.
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 DJ9xxVIPGS/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.
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.
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.
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 DJ9xxVIPThis 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 DJ9xxVIPThe old interface is degraded and will eventually be dropped. New printer drivers will not use the old interface.
../gs/gs5.50/ ../gs/gs5.50/jpeg/ ../gs/gs5.50/libpng/ ../gs/gs5.50/zlib/
../gs/hpijs/
gdevhpij.c gdevhpij.h contrib.mak unix-gcc.mak
# ../gs/gs5.50/make # ../gs/hpijs/make
# cp ../gs/gs5.50/obj/gs /usr/bin/ # cp ../gs/hpijs/hpijs /usr/bin/
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.
# 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
# rpm -ivh hpijs-0.96-1.rh62.i386.rpm # rpm -ivh --force ghostscript-hpijs-5.50-4.rh62.i386.rpm
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.
$ 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.
$ gs -sDEVICE=hpijs -sDeviceName=DJ9xx -r300x300 -dPrintMode=1 -dNOPAUSE -dSAFER -sOutputFile="/dev/lp0" file.ps -c quit