Remove lfs-uefi.txt symlink
[linux_from_scratch_hints.git] / PREVIOUS_FORMAT / hpdeskjet.txt
blobd1c4525dd00b7f28c2b9547526f526628daf969c
1 TITLE:          Setting up a local HP Deskjet Printer
2 LFS VERSION:    4.1+
3 AUTHOR:         Frank Gore <gore@projectpontiac.com> (LFS ID 3888)
4 SYNOPSIS:
5         Step-by-step instructions to get your HP Deskjet printer up and running
6         and generating great printing results with text, graphics and photos.
8 CHANGELOG:
9         August 11th, 2003
10          - upgraded to cups 1.1.19
11          - upgraded to ESP Ghostscript 7.05.6
12          - upgraded to HPIJS 1.4.1
13          - updated package download urls
14          - fixed the mknod command for USB printers (oops!)
15          - updated my email address
16          - added a "THANKS TO:" section
17         February 19th, 2003
18          - fixed a couple of typos
19         February 11th, 2003
20          - added optional a2ps-4.13b package
21          - added base online location of this hint
22            (http://www.projectpontiac.com/hints/hpdeskjet.txt)
23         February 10th, 2003
24          - added more dependencies
25          - changed build order of cups/ghostscript
26          - added printer configuration (resolutions, paper size, etc)
27          - added lots of miscellaneous info
28         February 9th, 2003
29          - first edition
31 HINT:
32         After spending endless days wading through the reams of printing
33         documentation available on the web, I was finally able to get my HP
34         Deskjet 932c printer working. While information regarding printing on a
35         Linux-based system is abundant, most of it is completely useless to the
36         average user. Hopefully this hint will allow others to use their HP
37         Deskjet printer to its full potential without having to spend days
38         figuring out what they need.
40         This hint is NOT intended to describe how to setup a network print
41         server. Its sole intention is to help users setup a single, local HP
42         Deskjet printer (any model) that they can send print jobs to and get
43         good results from. This hint covers both parallel and usb printers.
45         This hint *might* apply to other printer models as well, but you'll have
46         to find an appropriate driver. You can find a comprehensive list of
47         drivers at http://www.linuxprinting.org
49         The latest version of this hint can be found at:
50         http://www.projectpontiac.com/hints/hpdeskjet.txt
52 THANKS TO:
53         Thanks to members of the BLFS mailing lists for their help and
54         encouragement. This hint wouldn't exist without them :)
55         Most of the changes dated August 11th are present due to an email I
56         received from someone who used this hint, but I've misplaced the email
57         and cannot thank him by name here :( Sorry! If you read this, make
58         sure and email me so I can give credit where credit is due!
60 REQUIREMENTS:
61         Perl - this is part of a base LFS system
63 RECOMENDED:
64         libjpeg-6b & libpng-1.2.5 - most people have installed these by now :)
65         If you want Ghostscript to be able to handle images, you need these
66         intalled before you even begin this hint. Instructions for installing
67         these libraries can be found at http://beyond.linuxfromscratch.org
69         zlib-1.1.4 - this is installed as part of LFS 4.0, so you most
70         definitely should have it already. If not, have a look at the latest
71         LFS book at http://www.linuxfromscratch.org
73 DOWNLOADS:
74         CUPS-1.1.19 source
75 - ftp://ftp.easysw.com/pub/cups/1.1.19/cups-1.1.19-source.tar.bz2
77         ESP Ghostscript-7.05.6 source
78 - http://umn.dl.sourceforge.net/sourceforge/espgs/espgs-7.05.6-source.tar.bz2
80         GNU Ghostscript Fonts
81 - ftp://ftp.gnu.org/gnu/ghostscript/gnu-gs-fonts-std-6.0.tar.gz
82 - ftp://ftp.gnu.org/gnu/ghostscript/gnu-gs-fonts-other-6.0.tar.gz
84         HPIJS Driver source
85 - http://umn.dl.sourceforge.net/sourceforge/hpinkjet/hpijs-1.4.1.tar.gz
87         a2ps-4.13b source (this is optional)
88 - ftp://ftp.gnu.org/gnu/a2ps/a2ps-4.13b.tar.gz
90         cups-1.1.19 is the latest stable version of cups at the time of writing
91         this hint. If you have an older version of cups, you're strongly
92         encouraged to upgrade. Recent prior versions of cups had some major
93         bugs that could make printer management a nightmare.
95         ESP Ghostscript-7.05.6 is REQUIRED for the HPIJS driver to work. GNU
96         Ghostscript-7.05 and AFPL Ghostscript-8.00 did not work for me at all.
97         If you've already installed Ghostscript-8.00 and don't know how to
98         remove it, installing ESP Ghostscript-7.05.6 to the same directory
99         should overwrite it (it did for me).
101         The HPIJS driver is a free driver made available by HP. It's nice to see
102         commercial hardware manufacturers showing support for their products
103         under Linux :) Because of this, if I buy another printer in the near
104         future, it'll likely be an HP model. The latest version of this driver
105         supports most (if not all) of the features of almost every HP Deskjet
106         printer made over the last few years, including 300 to 1200 dpi output,
107         paper size, paper type, duplexing, and many others. This driver also
108         supports many other HP printers, including Photo printers and many
109         Laserjet printers. For a full list of supported printers, have a look at
110         http://hpinkjet.sourceforge.net/productssupported.php
112         a2ps-4.13b is a "anything to postscript" convertor. It's necessary for
113         printing out a sheet that lists all your printer's supported features,
114         which is incredibly handy for printer configuration after everything is
115         installed. I highly recomend it.
117 INSTALL:
118         First and foremost, we need to install cups-1.1.19. For this, I
119         followed the BLFS book precisely. Install CUPS by running the following
120         commands:
122 ./configure &&
123 make &&
124 make install
126         Specifying a --prefix is not necessary, the binaries will be installed
127         in /usr/bin by default. Create the CUPS startup file like this:
129 cat > /etc/rc.d/init.d/cups << "EOF"
131 #!/bin/sh
132 # Begin $rc_base/init.d/cups
134 # Start or stop the CUPS server based upon the first argument to the script.
136 source /etc/sysconfig/rc
137 source $rc_functions
139 case $1 in
140         start)
141                 echo "Starting CUPS Printserver..."
142                 loadproc /usr/sbin/cupsd
143         ;;
144         stop)
145                 echo "Stopping CUPS Printserver..."
146                 killproc cupsd
147         ;;
149         reload)
150                 echo "Reloading CUPS Printserver..."
151                 reloadproc /usr/sbin/cupsd
152         ;;
154         restart)
155                 $0 stop
156                 sleep 1
157                 $0 start
158         ;;
160         status)
161                 statusproc cupsd
162         ;;
164         *)
165                 echo "Usage: $0 {start|stop|reload|restart|status}"
166                 exit 1
167         ;;
168 esac
170 # End $rc_base/init.d/cups startup script.
173         Then make the startup script executable:
175 chmod 0755 /etc/rc.d/init.d/cups
177         cups installs its own set of startup scripts in your /etc/rc.d
178         directories, so we need to remove them:
180 rm /etc/rc.d/rc0.d/K00cups &&
181 rm /etc/rc.d/rc2.d/S99cups &&
182 rm /etc/rc.d/rc3.d/S99cups &&
183 rm /etc/rc.d/rc5.d/S99cups
185         And now we create our own symlinks to the startup script we generated
186         above:
188 cd /etc/rc.d/init.d &&
189 ln -sf ../init.d/cups ../rc0.d/K09cups &&
190 ln -sf ../init.d/cups ../rc2.d/S91cups &&
191 ln -sf ../init.d/cups ../rc3.d/S91cups &&
192 ln -sf ../init.d/cups ../rc4.d/S91cups &&
193 ln -sf ../init.d/cups ../rc5.d/S91cups &&
194 ln -sf ../init.d/cups ../rc6.d/K09cups
196         Now we can start cupsd by running:
198 /etc/rc.d/init.d/cups start
200         If everything is well at this point, we can proceed to install ESP
201         Ghostscript. For the most part, I followed the same installation
202         instructions outlined for Ghostscript 8.00 in the BLFS book, with a
203         couple minor changes:
205 ./configure --prefix=/usr --libexecdir=/usr/lib/gs \
206         --sysconfdir=/etc/gs --enable-shared \
207         --with-omni=no --enable-static &&
208 make &&
209 make install
211         I used this command to ensure that ESP Ghostscript-7.05.6 would
212         overwrite my previous installation of AFPL Ghostscript-8.00 (which
213         wasn't doing anything right). Incidentally, using --enable-shared
214         finally allowed my KDE ghostscript viewer (KGhostScript) to work
215         properly. It never did before with AFPL Ghostscript-8.00.
217         Following this, we need to install the GNU Ghostscript fonts. To do
218         this, issue the following commands:
220 cd /usr/share/ghostscript
221 tar xvfz /path/to/gnu-gs-fonts-std-6.0.tar.gz
222 tar xvfz /path/to/gnu-gs-fonts-other-6.0.tar.gz
224         Replace /path/to/ with the appropriate path where you downloaded the
225         font files to (ie. /usr/src/. This will create a "fonts" directory where
226         all the new fonts are stored for use by Ghostscript.
228         =======Optional=======
229         At this point, you may also install the optional a2ps package, which
230         helps tremendously when configuring your printer after it's been
231         installed. This is how you install a2ps-4.13b:
233 ./configure --prefix=/usr --libexecdir=/usr/lib/a2ps \
234     --sysconfdir=/etc/a2ps --localstatedir=/var \
235     --with-medium=letter &&
236 make &&
237 make install
239         If you live in an area where A4 is the standard paper format, replace
240         --with-medium=letter with --with-medium=a4 instead. You shouldn't need
241         to configure anything unless you want to get fancy, the default settings
242         worked fine for me.
243         =======End Optional=======
245         The next package we need to install is the HPIJS driver. Luckily, this
246         is quick and simple:
248 ./configure &&
249 make &&
250 make install
251         
252         This automatically installs to /usr/bin and you can confirm that the
253         driver was successfully installed by running
255 hpijs -h
257         This should output the name and version of the driver. We're almost done
258         now :) The driver is in place, but cups has no clue how to use it.
259         We need to download a small perl script that gets used by cups as
260         a filter. You can get the script by entering this address into your
261         browser:
263         http://www.linuxprinting.org/download.cgi?filename=cupsomatic&show=0
265         Depending on the browser you use, you'll either be asked to download the
266         file, or it will get displayed on your browser screen as text. If it
267         asks you to download the file, save it with this name:
269         /usr/lib/cups/filter/cupsomatic
271         If the file comes up as text in your browser, simply use the "Save As"
272         feature of your browser to save the file to the same location noted
273         above.
275         *** Please note, this assumes you installed cups using either the
276         directions provided above or the BLFS book. If not, the location of your
277         "filter" directory may vary. Use   find / -name filter   to find it.
279         Then make the file executable with the following command:
281 chmod 0755 /usr/lib/cups/filter/cupsomatic
283         This is very important, or nothing will work when you try to print.
285         Now you need to get a *.ppd file to tell cups how to use the HPIJS
286         driver. This is similar to obtaining the cupsomatic script. First,
287         you'll need to point your browser to this address:
289 http://www.linuxprinting.org/show_driver.cgi?driver=hpijs
291         Scroll down the page until you get to the section entitled "Printing
292         system interfaces". At the very first drop-down box (Select printer),
293         select the exact name and model of your printer (in my case, it was the
294         HP DeskJet 932C). Then click the "Generate PPD file" button. Again, your
295         browser will either ask you to download a file, or display a bunch of
296         text on your screen. You want to save this file as
298         /usr/share/cups/model/HP-DeskJet_***-hpijs.ppd
300         where *** is the model number of your printer (mine was 932C, so my
301         filename was /usr/share/cups/model/HP-DeskJet_932C-hpijs.ppd). If the
302         script comes up as text in your browser, then simply use the "Save As"
303         feature of your browser to save the file to the appropriate location.
305         *** Please note, this assumes you installed cups using either the
306         directions provided above, or the BLFS book. If not, the location of
307         your "model" directory may vary. Use   find / -name model   to find it.
309         At this point, you should restart cupsd so it re-reads the contents of
310         the "model" directory. If you installed cups as directed above, you can
311         restart it like this:
313 /etc/rc.d/init.d/cups restart
315         Now all we need to do is add the printer to the cups configuration. This
316         is perhaps the easiest part of all. If you have a parallel printer, run
317         this command:
319 lpadmin -p HP_Deskjet -m HP-DeskJet_***-hpijs.ppd -v parallel:/dev/lp0 -E
321         where *** is the model number of your printer (in my case, 932C). This
322         creates a new printer named "HP_Deskjet" and enables it. If you have a
323         USB printer, then run this command instead:
325 lpadmin -p HP_Deskjet -m HP-DeskJet_***-hpijs.ppd -v usb:/dev/usb/lp0 -E
327         without forgetting to change *** for the printer model number. Some
328         people might not have the /dev/usb/lp0 device since it doesn't come
329         standard in the LFS book. If that's the case for you, you can create it
330         like this:
332 mknod /dev/usb/lp0 c 180 0
334         Also, if you intend to use a USB printer, you need to make sure that
335         "USB Printer Support" is enabled in your kernel.
337         That's about it! You should now have a fully working printer. To try it
338         out, just use the lp command to send a file to the printer. For example:
340 lp /etc/motd
342         would print out the file /etc/motd (assuming your printer is turned on).
343         If you have more than one printer defined, you'll have to name the
344         printer you want to send the file to, like this:
346 lp -d HP_Deskjet /etc/motd
348         If you use a desktop environment (ie. KDE, Gnome), they should list your
349         printer and allow any native applications to use it. The default printer
350         configuration for Mozilla should work fine, so you can print web pages
351         without any issues even if you don't use a desktop environment. Most
352         other applications can simply be configured to use "lp" as the print
353         command. If you need more information about the "lp" command, check out
354         its man page.
356 CONFIGURATION:
358         The HPIJS driver allows you to change the quality of the print output,
359         all the way up to 1200 dpi in full colour (assuming your printer
360         supports that). Changing these options is as simple as passing them to
361         the lp command. However, you first need to know what features your
362         printer supports. If you want to find out what modes your printer
363         supports, issue the following command:
365 lp -o docs /etc/motd
367         The file specified is irrelevant, as long as it exists (it cannot be
368         /dev/null). It won't actually get printed. Instead, your printer will
369         print out a complete list of all the features it supports, as well as
370         the current defaults. If you have more than one printer installed, then
371         you'll have to specify which printer's features you want to see, like
372         so:
374 lp -d HP_Deskjet -o docs /etc/motd
376         Since my own printer is all I have to go on, I'll use that for the
377         following examples;
379         My printer supports the following print modes:
381         - 300BestColorCMYK
382         - 300ColorCMYK
383         - 300DraftColorCMYK
384         - 300DraftGrayscaleCMYK
385         - 300GrayscaleCMYK
386         - 300PhotoCMYK
387         - 600BestColorCMYK
388         - 600GrayscaleCMYK
389         - 600PhotoCMYK
390         - 1200PhotoCMYK
392         So when printing using the lp command, I simply pass an option to set
393         the printing mode. Using the example above, to print the /etc/motd file
394         in 300 dpi grayscale, I'd type the following command:
396 lp -o Resolution=300GrayscaleCMYK /etc/motd
398         Or if I wanted to print an image in 600 dpi colour, I'd issue the
399         following command:
401 lp -o Resolution=600BestColorCMYK /opt/kde-3.1/share/wallpapers/alien-night.jpg
403         The "Photo" modes are typically intended for glossy or photo paper and
404         don't provide very good results on plain paper. They also don't provide
405         good results with text.
407         Similarly, you can set the paper size and type using the same switch.
408         For example, my printer supports the following paper sizes:
410         - Letter
411         - A4
412         - A5
413         - A6
414         - B5JIS
415         - Executive
416         - FLSA
417         - Hagaki
418         - Legal
419         - Oufuku
420         - Photo
422         So to print onto Letter-sized paper, I'd run the following command:
424 lp -o PageSize=Letter /etc/motd
426         Again, the different sizes of paper supported by your printer are listed
427         on the printout we generated earlier.
429         You can specify multiple -o switches in the same command. If I wanted to
430         print onto letter paper at 600 dpi in grayscale, I'd do it like this:
432 lp -o Resolution=600GrayscaleCMYK -o PageSize=Letter /etc/motd
434         Of course, typing out all these options everytime you want to print a
435         file can be tiresome and error-prone. So your best bet is to set some
436         default values that will always be used unless you override them with
437         -o switches. If most of your printing involves colour graphics (with or
438         without text), then you'd most likely want to set 600 dpi colour as your
439         printing default. Setting defaults is a simple command:
441 lpoptions -o Resolution=600BestColorCMYK
443         You can also set multiple -o switches with the lpoptions command:
445 lpoptions -o Resolution=600BestColorCMYK -o PageSize=Letter
447         After issuing this command, lp will always print in 600 dpi with full
448         colour onto letter-sized paper, unless you override the defaults by
449         including different -o switches. Typing lpoptions by itself on the
450         command line will list your current defaults.
452         There are many other uses for the lpoptions command. If you need to know
453         more, I recomend reading the lpoptions man page.
455         Using different front ends (ie. the KDE Printing Manager) allows you to
456         change these defaults and settings interactively without having to deal
457         with command lines. These front ends also make it a lot easier to deal
458         with margins, orientation and printable areas. All of these settings can
459         be adjusted using the lpoptions command, but explaining them all would
460         require a complete How-To :) I highly recomend using one of the
461         more advanced graphical front ends if you need more functionality.
463         I hope this was helpful to someone out there! If there's anything else
464         you think should be included in this hint, let me know.