hpdeskjet.txt

Frank Gore fgore at sympatico.ca
Sun Feb 9 15:44:08 PST 2003


Submitted for your approval :)

This is a new hint I just wrote up titled:

- Setting up a local HP Deskjet Printer

Frank Gore
-------------- next part --------------
TITLE:		Setting up a local HP Deskjet Printer
LFS VERSION:	4.1
AUTHOR:		Frank Gore <fgore at sympatico.ca>

SYNOPSIS:
	Step-by-step instructions to get your HP Deskjet printer up and running
	and generating great printing results with text, graphics and photos.

CHANGELOG:
	February 9th, 2003 - First edition

HINT:
	After spending endless days wading through the reams of printing
	documentation available on the web, I was finally able to get my HP
	Deskjet 932c printer working. While information regarding printing on a
	Linux-based system is abundant, most of it is completely useless to the
	average user. Hopefully this hint will allow others to use their HP
	Deskjet printer to its full potential without having to spend days
	figuring out what they need.

	This hint is NOT intended to describe how to setup a network print
	server. Its sole intention is to help users setup a single, local HP
	Deskjet printer (any model) that they can send print jobs to and get
	good results from. This hint covers both parallel and usb printers.

	This hint *might* apply to other printer models as well, but you'll have
	to find an appropriate driver. You can find a comprehensive list of
	drivers at http://www.linuxprinting.org

REQUIREMENTS:
	Perl (should be part of a base LFS system)

DOWNLOADS:
	CUPS-1.1.18 source
- ftp://ftp.easysw.com/pub/cups/1.1.18/cups-1.1.18-source.tar.bz2

	ESP Ghostscript-7.05.5 source
- http://unc.dl.sourceforge.net/sourceforge/espgs/espgs-7.05.5-source.tar.bz2

	GNU Ghostscript Fonts
- ftp://ftp.gnu.org/gnu/ghostscript/gnu-gs-fonts-std-6.0.tar.gz
- ftp://ftp.gnu.org/gnu/ghostscript/gnu-gs-fonts-other-6.0.tar.gz

	HPIJS Driver Source
- http://unc.dl.sourceforge.net/sourceforge/hpinkjet/hpijs-1.3.1.tar.gz

	cups-1.1.18 is the latest stable version of cups at the time of writing
	this hint. ESP Ghostscript-7.05.5 is REQUIRED for the HPIJS driver to
	work. GNU Ghostscript-7.05 and AFPL Ghostscript-8.00 did not work for
	me at all. If you've already installed Ghostscript-8.00 and don't know
	how to remove it, installing ESP Ghostscript-7.05.5 to the same
	directory should overwrite it (it did for me). The HPIJS driver is a
	free driver made available by HP. It's nice to see commercial hardware
	manufacturers showing support for their products under Linux :) Because
	of this, if I buy another printer in the near future, it'll likely be
	an HP model.

INSTALL:
	First and foremost, we need to install ESP Ghostscript. For the most
	part, I followed the same installation instructions outlined for
	Ghostscript 8.00 in the BLFS book, with a couple minor changes:

./configure --prefix=/usr --libexecdir=/usr/lib/gs \
	--sysconfdir=/etc/gs --enable-shared
	--with-omni=no --enable-static &&
make &&
make install

	I used this command to ensure that ESP Ghostscript-7.05.5 would
	overwrite my previous installation of AFPL Ghostscript-8.00 (which
	wasn't doing anything right). Incidentally, using --enable-shared
	finally allowed my KDE ghostscript viewer (KGhostScript) to work
	properly. It never did before with AFPL Ghostscript-8.00.

	Following this, we need to install the GNU Ghostscript fonts. To do
	this, issue the following commands:

cd /usr/share/ghostscript
tar xvfz /path/to/gnu-gs-fonts-std-6.0.tar.gz
tar xvfz /path/to/gnu-gs-fonts-other-6.0.tar.gz

	Replace /path/to/ with the appropriate path where you downloaded the
	font files to. This will create a "fonts" directory where all the new fonts are
	stored for use by Ghostscript.

	Next we need to install cups-1.1.18. For this, I followed the BLFS book
	precisely. Install CUPS by running the following commands:

./configure &&
make &&
make install

	Specifying a --prefix is not necessary, the binaries will be installed
	in /usr/bin by default. Create the CUPS startup file like this:

cat > /etc/rc.d/init.d/cups << "EOF"

#!/bin/sh
# Begin $rc_base/init.d/cups

# Start or stop the CUPS server based upon the first argument to the script.

source /etc/sysconfig/rc
source $rc_functions

case $1 in
	start)
	        echo "Starting CUPS Printserver..."
		loadproc /usr/sbin/cupsd
	;;
	stop)
		echo "Stopping CUPS Printserver..."
		killproc cupsd
	;;

	reload)
		echo "Reloading CUPS Printserver..."
		reloadproc /usr/sbin/cupsd
	;;

	restart)
		$0 stop
		sleep 1
		$0 start
	;;

	status)
		statusproc cupsd
	;;

	*)
		echo "Usage: $0 {start|stop|reload|restart|status}"
		exit 1
	;;
esac

# End $rc_base/init.d/cups startup script.
EOF

	Then make it executable:

chmod 0755 /etc/rc.d/init.d/cups

	cups installs its own set of startup scripts in your /etc/rc.d
	directories, so we need to remove them:

rm /etc/rc.d/rc0.d/K00cups &&
rm /etc/rc.d/rc2.d/S99cups &&
rm /etc/rc.d/rc3.d/S99cups &&
rm /etc/rc.d/rc4.d/S99cups &&
rm /etc/rc.d/rc5.d/S99cups

	And now we create our own symlinks to the startup script we generated
	above:

cd /etc/rc.d/init.d &&
ln -sf ../init.d/cups ../rc0.d/K09cups &&
ln -sf ../init.d/cups ../rc2.d/S91cups &&
ln -sf ../init.d/cups ../rc3.d/S91cups &&
ln -sf ../init.d/cups ../rc4.d/S91cups &&
ln -sf ../init.d/cups ../rc5.d/S91cups &&
ln -sf ../init.d/cups ../rc6.d/K09cups

	Now we can start cupsd by running:

/etc/rc.d/init.d/cups start

	If everything is well at this point, we can proceed :) The next package
	we need to install is the HPIJS driver. Luckily, this is quick and
	simple:

./configure &&
make &&
make install
	
	This automatically installs to /usr/bin and you can confirm that the
	driver was successfully installed by running

hpijs -h

	This should output the name and version of the driver. We're almost done
	now :) The driver is in place, but cups has no clue how to use it.
	First, we need to download a small perl script that gets used by cups as
	a filter. You can get the script by entering this address into your
	browser:

	http://www.linuxprinting.org/download.cgi?filename=cupsomatic&show=0

	Depending on the browser you use, you'll either be asked to download the
	file, or it will get displayed on your browser screen as text. If it
	asks you to download the file, save it with this name:

	/usr/lib/cups/filter/cupsomatic

	If the file comes up as text in your browser, simply use the "Save As"
	feature of your browser to save the file to the same location noted
	above.

	*** Please note, this assumes you installed cups using either the
	directions provided above or the BLFS book. If not, the location of your
	"filter" directory may vary. Use   find / -name filter   to find it.

	Then make the file executable with the following command:

chmod 0755 /usr/lib/cups/filter/cupsomatic

	This is very important, or nothing will work when you try to print.

	Now you need to get a *.ppd file to tell cups how to use the HPIJS
	driver. This is similar to obtaining the cupsomatic script. First,
	you'll need to point your browser to this address:

http://www.linuxprinting.org/show_driver.cgi?driver=hpijs

	Scroll down the page until you get to the section entitled "Printing
	system interfaces". At the very first drop-down box (Select printer),
	select the exact name and model of your printer (in my case, it was the
	HP DeskJet 932C). Then click the "Generate PPD file" button. Again, your
	browser will either ask you to download a file, or display a bunch of
	text on your screen. You want to save this file as

	/usr/share/cups/model/HP-DeskJet_***-hpijs.ppd

	where *** is the model number of your printer (mine was 932C, so my
	filename was /usr/share/cups/model/HP-DeskJet_932C-hpijs.ppd). If the
	script comes up as text in your browser, then simply use the "Save As"
	feature of your browser to save the file to the appropriate location.

	*** Please note, this assumes you installed cups using either the
	directions provided above, or the BLFS book. If not, the location of
	your "model" directory may vary. Use   find / -name model   to find it.

	At this point, you should restart cupsd so it re-reads the contents of
	the "model" directory. If you installed cups as directed above, you can
	restart it like this:

/etc/rc.d/init.d/cups restart

	Now all we need to do is add the printer to the cups configuration. This
	is perhaps the easiest part of all. If you have a parallel printer, run
	this command:

lpadmin -p HP_Deskjet -m HP-DeskJet_***-hpijs.ppd -v parallel:/dev/lp0 -E

	where *** is the model number of your printer (in my case, 932C). This
	creates a new printer named "HP_Deskjet" and enables it. If you have a
	USB printer, then run this command instead:

lpadmin -p HP_Deskjet -m HP-DeskJet_***-hpijs.ppd -v usb:/dev/usb/lp0 -E

	without forgetting to change *** for the printer model number. Some
	people might not have the /dev/usb/lp0 device since it doesn't come
	standard in the LFS book. If that's the case for you, you can create it
	like this:

mknod c 180 0 /dev/usb/lp0

	Also, if you intend to use a USB printer, you need to make sure that
	"USB Printer Support" is enabled in your kernel.

	That's about it! You should now have a fully working printer. To try it
	out, just use the lp command to send a file to the printer. For example:

lp /etc/motd

	would print out the file /etc/motd (assuming your printer is turned on).
	If you have more than one printer defined, you'll have to name the
	printer you want to send the file to, like this:

lp -d HP_Deskjet /etc/motd

	If you use a desktop environment (ie. KDE, Gnome), they should list your
	printer and allow any native applications to use it. The default printer
	configuration for Mozilla should work fine, so you can print web pages
	without any issues even if you don't use a desktop environment. Most
	other applications can simply be configured to use "lp" as the print
	command. If you need more information about the "lp" command, check out
	its man page.

	The HPIJS driver allows you to change the quality of the print output,
	all the way up to 1200 dpi in full colour. However I'm not aware how to
	change this manually. I use the KDE Printing Manager to make such
	changes. I assume the Gnome equivalent also allows you to do this. If I
	ever figure out how to set the print options (print quality, paper size,
	duplexing, margins) manually, I'll add the information to this hint. At
	300 dpi (the default), the print quality is "adequate". But at 600 dpi
	and above, my printer is providing me with some stunning output!

	I hope this was helpful to someone out there! If there's anything else
	you think should be included in this hint, let me know.


More information about the hints mailing list