5. Configure Magicfilter using Magicfilterconfig

5.1. Basic configuration

Lpr uses a printer capabilities database file called /etc/printcap to store details about your printer's configuration. Magicfilterconfig needs to change some of the information in this file. Rather than making changes automatically, magicfilterconfig creates a new printcap file which you can use to replace the original one by hand. This leaves you in full control. You can always restore the original printcap file if the new one causes problems.

Magicfilterconfig asks you to provide a name for your printer and a short name for its spool directory. These can be anything you like, but you should try and make them recognisable. (I decided on 'Canon BJC-4200' for my printer's name and 'myCanon' for the spool directory.) Magicfilterconfig will also ask you for the device name of your printer port. This would be /dev/lp0 for a printer plugged into the lp0 (LPT1) parallel port. For a serial printer /dev/tty0 is the device for the tty0 (COM1) port, and /dev/tty1 for the tty1 (COM2) port.

You must also supply the name of the Magicfilter input filter that you chose in "Choosing an input filter" above. You can check that the input filter suits your printer by reading the first few lines of the filter file with a text editor. The files are in the /etc/magicfilter directory.

Magicfilterconfig prompts you to enter the full name for a second printer. Enter 'none' if you do not wish to set up a second printer.

# magicfilterconfig

Printer #1:
------------
  Full name, `done' when done                   [HP Laserjet 4L ]: Canon BJC-4200 enter
  Short name, name of the spool directory       [hplj4l         ]: myCanon enter
  Full device path (or remote machine name)     [/dev/lp1       ]: /dev/lp0 enter

(List of filters appears here.)

  The input filter to be used                   [ljet4l         ]: bj600 enter

Printer #2:
------------
  Full name, `done' when done                   [done           ]: done enter

Magicfilterconfig now summarises the settings you have chosen, and asks you to confirm them:

                       Printer configuration

Printer name  Short name Spool dir            Device     Input filter
-------------------------------------------------------------------------------
Canon BJC-420 myCanon    /var/spool/lpd/myCan /dev/lp0   bj600              *

	  Is this ok? (y/n) [y]: y enter

Some messages appear here. They are summarised in the next two sections.

Press  <ENTER> to continue. enter

#

Your new printcap file has been created in /var/tmp.

5.2. Fine tune the configuration

One of Magicfilterconfig's messages suggested that you may wish to fine tune your newly created /var/tmp/printcap file. Such modifications are beyond the scope of this article. If you wish to go ahead, Magicfilterconfig suggests that you read the printcap(5), lpr(1), lpq(1), lprm(1) and lpc(1) manual pages and the PRINTING-HOWTO first.

5.3. Install the new printcap file

Now all you need to do is replace the original /etc/printcap file with your new /var/tmp/printcap file. Keep the original printcap by renaming it to /etc/printcap.orig. You must stop Lpr temporarily while you do this.

Stop the running Lpr:

# /etc/init.d/lpr stop

Save the old printcap:

# mv /etc/printcap /etc/printcap.orig

Install Magicfilter's printcap:

# mv /var/tmp/printcap /etc/printcap

Start Lpr:

# /etc/init.d/lpr start

5.4. Test your new configuration

That's it! Try printing from an application that produces ASCII code and one that produces PostScript. The 'Emacs' editor does both. 'Print' sends ASCII output to the spooler and 'Pretty-print' sends PostScript.

It worked for me! I hope it works for you.