Chapter 12 Printers In the context of installing with YaST, you have probably already carried out your first printer configuration in Linux (see Section 3.6.1 page 90). This chapter will explain the essential processes going on "behind the scenes": not every detail, but enough for you to be able to understand the basic scheme of the printing process. 12.1 Overview: Interfaces, Queues and Spooling The Parallel Ports A printer is normally connected via the parallel port in Linux. The Current 2.2.xx Kernel From kernel version 2.2.x onwards, the parport sub-system is included. This sub-system needs to know what kind of parallel port device you have attached, so that it can load additional drivers required for the specific com- puter architecture. (cf. Section 10.4.3 page 267 pp.). Now, multiple devices, all connected to the same parallel port, may be used simultaneously. More- over, the numbering of the parallel ports now starts with /dev/lp0 (It is no longer /dev/lp1!) To be able to print via the first parallel port you need to load the modules parport, parport_pc and lp into the standard SuSE kernel. This is normally done automatically by the kmod "kernel module loader" (see Section 13.2 page 319), as soon as a print job is sent to the queue. If the parallel devices are not found, you might need to add some kernel parameters. See also page 355. You can test the printer and its interface, but only as user `root' ( System administrator), by sending data directly to the printer, with a command such as: earth: # echo hello > /dev/lp0 or earth: # cat TEXTFILE > /dev/lp0 Although this method works, it is not recommended to print in this fashion. Instead, it is preferable to send your printing jobs to a print queue. Printing queues allow multiple users to share one printer, and administer the print jobs in an orderly fashion. 293 12. Printers The ports are by default set to polling mode (the CPU must regularly en- quire if a data transfer is waiting). The system administrator, `root' can, when loading the parport system, change this to the more favourable in- terrupt operation, via the /proc filesystem, as well as make further changes to improve performance, with the program tunelp. Refer to the manpage for tunelp (man tunelp) and also the documents for the kernel sources mentioned in Section 10.4.3 page 267 pp. But before you do this, check the IRQ and port settings for the port hardware (usually done in the BIOS, or with jumpers). Spooling Mode and Printer Queues Printers are accessed in Linux via a spooling mechanism, meaning, printer jobs are temporarily saved in a file and are processed in the order they were received by a job control program, called a daemon. This ensures that many users can send printer jobs simultaneously to the printer without risk of con- flicts. After sending the printer a job, you can resume work as normal. A printer queue consists of: * an entry in /etc/printcap; where the queue is defined; * a directory, typically a subdirectory of /var/spool/lpd; where each printer job has a data file and a control file. Each queue is processed by one printer only. There can be several printer queues for the same printer. SuSE Linux includes the BSD spooling system from the University of Cali- fornia at Berkeley, which is included in package lprold. Traditionally, it is designed for use over a network and assumes that TCP/IP has been config- ured and is running. Whether queues are set to local or remote makes little difference to the configuration. Processing a print job takes place in three steps: * The data file is copied to the queue's directory and is assigned to a freshly created control file. * This data file has now to pass through a filter program which converts it to the printer-specific format (e. g., PostScript), i.e the filter program creates a data stream in the printer-specific format (e.g. PostScript, PCL, Esc/P2 etc.). This conversion may consist of more than one step and in SuSE Linux is taken care of by apsfilter (package aps); see below, Section 12.3 page 298 pp. ....This conversion can consist of several individual steps. * The printer-specific file is now queued and printed in order. 12.2 Printer Queues: Running and Configuring Let's examine the stages a print job has to pass through before being printed, and also the programs that take care of the job. Many more details on the printing process can be found in the lpr(1), lpd(8) and printcap(5) manpages. 294 12.2. Printer Queues: Running and Configuring lpr: Please Line up! lpr is your "interface" to the printer queues on your machine. Normally a job is started using: newbie@earth: > lpr [-Pqueue] text-file If you omit the option -P ( for "Printer", the queue's name), the default is taken from the PRINTER environment variable. If this is not set, the default name lp is used. The same applies for the commands lpq, lprm and lpc (see below). There must not be a space between the option -P and the printer name queue. lpr checks whether this queue exists by reading /etc/printcap. If this is the case, a control file (cf file) and a copy of the data file are created in the spool directory. If this is a very large job, it might be useful just to link the file instead of copying it. This can be done with lpr -s. You should not write to this file again until the job has been processed. lpr allows you to set a specific filter (printer driver) for your job by hand, but this is hardly ever required. More on this can be found in man lpr, and in Section 12.3 page 298. Additional Control Tools: Overview Any of the commands described in this section will accept the -P option for passing a job to a named queue, just as lpr does. more detailed information can be found in the corresponding manpages. You need to have `root'-permissions to be able to manipulate the printer queues, i.e. if you want to delete other people's print jobs, for example, you must work as `root'. * lpq shows your own jobs in the queue: For example: newbie@earth: > lpq -Pqueue queue is ready and printing Rank Owner Job Files Total Size active newbie 676 Hello.txt 259420 bytes 1st newbie 677 letter.dvi 11578 bytes 2nd newbie 683 picture.gif 37464 bytes Screen output 12.2.1: Example output of the command lpq. * lprm removes your own jobs from a queue. Thus entering this: newbie@earth: > lprm -Pqueue 676 will produce the following output: If no job number is given, the current active job is removed-if it is your own job. 295 12. Printers dfA676Aa05005 dequeued cfA676Aa05005 dequeued Screen output 12.2.2: Example output of the command lprm. * ....lpc executes control commands for queues. Most of these commands can only be performed by the user "root". * lpc (with the path /usr/sbin/lpc) Controls the queues. For queue names you can also specify all. The most important options are: ­ status queue Provides a status report. If the queue argument is missing then this functions like all, i. e. Status report for all queues. ­ disable queue Stops new jobs being moved to the queue. ­ enable queue Releases the queue to accept new jobs. ­ stop queue Stops jobs from the queue being printed (the job cur- rently being printed is completed). ­ start queue Starts printing jobs again from the queue. ­ down queue Is the same as disable plus stop. ­ up queue Is the same as enable plus start. ­ abort queue Is the same as down, except that a job currently being printed is interrupted immediately. The jobs remain, however, and printing can be continued after the queue is re-started (up). You can pass these commands on to lpc directly in the command line (e. g. lpc status). Or you can run lpc without parameters: then the dialog mode with its own prompt, lpc> is started, awaiting the entry of lpc-commands. You can end the dialog with quit or exit. Printing jobs remain in the queues even when you shut down the computer during printing, and then start Linux again. A printing job which might have gone wrong must be removed from the queue with the commands shown above. lpd: the Print Manager in the Background The lpd Line Printer Daemon is launched by /sbin/init.d/ lpd and runs in the background, assuming the corresponding option START LPD=yes has been set in /etc/rc.config (see Section 3.6.11 page 101). lpd checks /etc/printcap to see which printer queues are defined. Its job is to organize the execution of spooled jobs: * it manages local printer queues: it sends every job's data file through the appropriate filter-which is assigned by the entry in /etc/printcap and by an explicit setting in the control file-and then to the printer inter- face; * it takes care of the order of the jobs; * it checks the status of queues and printers in the local spool directories; 296 12.2. Printer Queues: Running and Configuring * it sends jobs to an lpd on a remote machine; * it accepts requests from remote machines for local queues or refuses them if authorization fails. Authorization: Only requests from hosts who are listed in /etc/hosts. lpd are executed. It is also possible to enter the name in /etc/hosts. equiv, but this has far-reaching consequences as far as access and security are concerned and, therefore, should be avoided (refer also to the security capital, Section 18.2.2 page 425). Additional definitions of the queue can restrict access to certain users, or users with an account on the local machine. Filter: the Workaholics The job of the filter programs is to transfer the jobs into a printer-specific format. They have to be able to do almost everything. They more or less resemble the printer drivers on other systems, such as Windows or OS/2. But, unlike them, they are also used to count jobs (number, resources used, etc.) (see Section 12.3 on the next page). /etc/printcap: Configuration of the Queue In /etc/printcap, each queue is defined by an entry of its own, ter- minated by a line feed. The entry starts with one or more names for the queue (separated by | ), followed by a list of specifications1, such as abbreviation= (separated by : ). "Empty" lines, or those starting with a `#', are regarded as comments. There are a couple of example entries (commented) in /etc/printcap. A simple entry might look like this: ascii|deskjet:lp=/dev/lp1:sd=/var/spool/ascii:sh:mx#10240 File contents 12.2.1: /etc/printcap for a simple local queue This queue can be accessed either by ascii or by deskjet. Its spool directory is /var/spool/ascii. Its printer is /dev/lp0. It does not show a header page at the beginning (sh = suppress header) and accepts jobs up to a size of 10240 bytes. ­ An example for the queue on a remote computer can be found in File contents 12.2.2 on the following page; to configure this, refer to Section 12.4 page 304 pp.2 The queue has the names lp1 and HP-4P. Instead of device informa- tion, reference is made here to the host helios.cosmos.com and its queue, HP. Details of filters are unnecessary ­ for these, the queue for helios.cosmos.com is responsible ­ so that here only the spooling direc- tory /var/spool/lpd/lp1 and the size limitation for jobs (mx#0 means: no limit) have been defined. 1 All abbreviations, their meanings and default settings, are described in the printcap man- page. 2 the backslash directly before the line break "hides" this ­ just as when entering shell commands ­, so that the entry counts just as one line. 297 12. Printers lp1|HP-4P:\ :rm=helios.cosmos.com:\ :rp=HP:\ :sd=/var/spool/lpd/lp1:\ :mx#0:sh File contents 12.2.2: /etc/printcap: Simple remote queues If you use the apsfilter, the new printer queues needed are automatically entered into the /etc/printcap. For more details, see Section 12.3 page 300. If you install apsfilter with YaST, it creates three new queues in /etc/ printcap. Further information can be found in Section 12.3 page 300. 12.3 Printer Filters What is a Filter and How Does it Work? As mentioned above, the job of a filter is to convert the data file of a print job into a suitable format for the printer. Only the paper size, login name, host name (local), and name of the file for the count is passed to lpd. Being a UNIX filter, it gets the data file via STDIN (standard input) and sends the printable output through STDOUT (standard output). The filter has to know the format of the file (ASCII, DVI, PostScript, etc.), of course, to be able to convert it. There are two ways of accomplishing this: * The filter is "intelligent" enough to recognize the file format, and consists of a "pre-filter" to do this, and many other programs which actually handle the conversion. This is roughly how apsfilter works, which is installed by default with SuSE Linux. * There are different filters for different file formats. These filters are as- signed to a specific queue by entering them in /etc/printcap. You have to specify an additional option when using lpr. There are eight op- tions available: printcap Entry if= cf= df= gf= nf= rf= tf= vf= lpr Option -c -d -g -n -f -t -v By convention, these options3 are assigned to special file formats. Only the option for lpr needs to be set.4 if= refers to the standard filter, whereas df= refers to DVI files (that come from TEX and LATEX). Thus you might make your own DVI filter for the HP LaserJet 4, with an entry in the File contents 12.3.1 on the facing page, if the package package te dvilj is installed (nowadays, however, it is recommended, even for this printer, to use the relevant Ghostscript-"driver" ljet4 instead). 3 see the lpr manpage. 4 Thus, a so-called "zero-filter entry", e.g., cf=/bin/cat, is allowed and is used with lpr -c. 298 12.3. Printer Filters ­ the "apsfilter" df="/usr/bin/dvilj4 -e- -" File contents 12.3.1: DVI filter entry in /etc/printcap apsfilter The package aps includes a very convenient filter, apsfilter. apsfilter is especially useful under the following circumstances: * If the standard format for printable files in UNIX is PostScript. * If there are many separate tools that convert other formats, such as TEX and pictures, into PostScript files (e. g.dvips for DVI files and a2ps for ASCII files). * Then there is Ghostscript, which is capable of converting PostScript files to a variety of printer-specific formats for non-PostScript printers (a col- lection of printer drivers, so to speak). apsfilter combines almost all of these separate tools, including the tools for recognizing a specific format (file) and decompression tools, into one. It sends the result of the format recognition through the appropriate tools, and, finally, to the printer. In /var/lib/apsfilter/apsfilter (the central shell script), the fol- lowing file formats and compression types are available: * ASCII, DVI, PS, Data (PCL, etc.), GIF, TIFF, PBM, Sun Raster, X11 Bitmap * Compression types: compress, gzip, freeze apsfilter can either be configured with YaST, or with its own menu-driven script, SETUP (lprsetup). The apsfilter Printer Queues The program apsfilter provides the following queues for a local printer: lp ­ the standard printer queue for all file formats lp-mono ­ only used with color printers and prints in black and white, otherwise processes all formats, like lp ascii ­ prints files as ASCII text files, even if the spooling system expects a different format 5 raw ­ prints files which are already in a printer-specific format: no conver- sion takes place. You can also configure further local printers; to differentiate between them, the queue names contain the name of the relevant Ghostscript-printer driver, such as djet500, djet500-ascii, djet500-raw etc. ASCII files: Default settings for filtering are located in the file /etc/apsfilterrc: 5 for example, if German umlauts are present. 299 12. Printers * convert ASCII files with a2ps to PostScript; * a2ps format: 2 ASCII-pages next to each other in oblong format, on one printed page. You can change the format by setting the variable FEATURE in /etc/ apsfilterrc, to a different value suggested in the commentary. If you want to avoid the conversion to PostScript completely and print using the ASCII mode of the printer, just remove the hash sign, "#", at the beginning of the line USE RECODE NOT A2PS=yes, and make sure that the package recode, series ap, is installed. apsfilter: Configuration apsfilter can be configured with YaST or with its own, menu-driven SETUP script. The configuration will only work correctly if the reference characters in /etc/printcap at the beginning and end of the apsfilter entries are left unchanged (cf. File contents 12.3.2 on the next page)! Configuration Using YaST the normal way to set up a local printer is by configuring the printer with YaST If another apsfilter configuration exists, YaST will ask at the beginning if you want to overwrite the old configuration, or if the new configuration should be written in addition. What you do next has already been described in YaST, Section 3.6.1 page 90 pp. If you want to install your new configuration, this happens in the following sequence (irrespective of whether you used YaST or SETUP to configure): * Create the new printer queues in /etc/printcap (cf. on the page before). * Create the spool directories for these in /var/spool/lpd/. * Create the relevant printer filters in /var/lib/apsfilter/bin/ (these are symbolic links to the file /var/lib/apsfilter/apsfilter). * Create the global configuration file /etc/apsfilterrc (if this doesn't exist) and a printer-specific configuration file, /etc/apsfilterrc.. The following example is the for the Ghostscript-printername, e. g. bjc800. File contents 12.3.2 on the facing page, shows an example for the newly created printer queue of the Canon BubbleJet 800. In this example, the three entries are constructed in the same way. This is why we have shortened them. They specify the device (lp=), the spool directory (sd=), the log file (lf=), the count file (af=) and the standard filter (if=). The header at the beginning (sh), and the formfeed (sf), at the end of a job, are suppressed. 300 12.3. Printer Filters ­ the "apsfilter" ### BEGIN apsfilter: ### bjc800 a4 mono 360 ### # Warning: Configured for apsfilter, do not edit the labels! # apsfilter setup Thu Sep 18 11:40:40 MEST 1997 #ascii|lp1|bjc800-a4-ascii-mono-360|bjc800 a4 ascii mono 360:\ :lp=/dev/lp0:\ :sd=/var/spool/lpd/bjc800-a4-ascii-mono-360:\ :lf=/var/spool/lpd/bjc800-a4-ascii-mono-360/log:\ :af=/var/spool/lpd/bjc800-a4-ascii-mono-360/acct:\ :if=/var/lib/apsfilter/bin/bjc800-a4-ascii-mono-360:\ :la@:mx#0:\ :sh:sf: #lp|lp2|bjc800-a4-auto-mono-360|bjc800 a4 auto mono 360:\ # [ ... abbreviated ... ] #raw|lp3|bjc800-a4-raw|bjc800 a4 raw:\ # [ ... abbreviated ... ] ##### END apsfilter: ### bjc800 a4 mono 360 ### File contents 12.3.2: apsfilter printer queues in /etc/printcap Configuration with SETUP The package aps contains the configuration program /var/lib/apsfilter/SETUP. This offers the following services: * A list of all apsfilter printer configurations * Allows insertion and deletion of apsfilter printer configurations When inserting local printers, SETUP does (almost) the same as YaST. In addition, SETUP can also create and delete printer queues which point to remote hosts ("remote printer queues", cf. File contents 12.2.2 page 298), and also prepare a pre-filter for network printers, in an intelligent manner. SETUP is menu-driven and ­ once you are familiar with it ­ easy to operate. 1. Start SETUP: earth: # /var/lib/apsfilter/SETUP If you have trouble seeing things in an xterm in the X Window System (keyword: yellow on a light-gray background), then you should start SETUP at the command level. ­ A welcome screen appears, describing the above-mentioned procedures for the creation of new apsfilter printers. Press and you will reach the main menu: EXIT Exit apsfilter setup LISTING List all apsfilter entries ENTRY Add/Overwrite/Delete an apsfilter entry DELETE Fast delete an apsfilter entry 301 12. Printers To choose the confirmation tabs `OK' and `Cancel', you can use Tab (= Tab ) in all the menus; use the and to move through the selection lists. `EXIT' ­ end SETUP. `LISTING' ­ list all existing queues. `ENTRY' ­ To add a new printer the menu item `ENTRY' is used. This leads to another menu, `Choose your printer defini- tion', in which you define your printer. `DELETE' ­ To delete an existing apsfilter- printer, select `DELETE', and you will receive a list of current apsfilter-printers to choose from. 2. Then select `ENTRY'. For a local printer you are asked for the same details as in the configuration with YaST. First, you are asked for the `DEVICE' (interface); for a local printer on the parallel port you should answer with /dev/lp0 for a kernel 2.2.xx. 3. Now you should see the following: RETURN Back to previous menu DEVICE Change printer interface PRINTER Which printer driver PAPER Which paper type COLOR Monochrome/color SPECIAL Settings for your printer RESET Reset the printer definition ADD Add the printer definition OVERWRITE Overwrite the printer definition DELETE Delete the printer definition `DEVICE' ­ We have already chosen this. `PRINTER' ­ Let's now take a look at the `PRINTER'. Here, the relevant Ghostscript device definition ("driver") is selected. This is performed in two steps: (a) First, select your printer type from the options: * `PostScript' * `HEWLETT-PACKARD' (HP Deskjets) * `OTHER' (other, non-PostScript compatible printers) * `FREEDEF' (free definition) (b) For genuine PostScript-printers you only need to define the reso- lution in a dialog window. For other printers, you will find a list of possible Ghostscript-drivers in the menu item `COMMIT'. Use Section 12.6 page 307 here for reference. After you have selected a Ghostscript-driver you should define the resolution of your printer in the dialog window which then appears. With `RETURN' you can move back to the previous menu. `PAPER' ­ The paper format. `COLOR' ­ Color or black and white. `SPECIAL' ­ Usually these details are not needed. 302 12.3. Printer Filters ­ the "apsfilter" 4. You should now be back in the menu `Choose your printer de- finition'. If you have made any mistakes in your definition, you can go back to the relevant sub-menus and make corrections. 5. Important: Pressing `ADD' will finally install the new printer. Take a look ­ for example, with less6 ­ in the file /etc/printcap for the names of your new printer queues. Each apsfilter-printer queue has several names: detailed ones, describing the files of their definition, and short ones, for convenience (see File contents 12.3.2 page 301). In addition, lp, lp-mono, ascii, and raw are the printer queues for the first local printer. The Configuration Files, apsfilterrc The files /etc/apsfilterrc* allow you the option of controlling de- tails of the operation of the apsfilter-shell scripts more closely, by means of certain shell variables. The following variables are set up by default, during installation: * a global /etc/apsfilterrc, * printer­specific files, /etc/apsfilterrc., in each case for the queues with the Ghostscript-printer driver (for example, for the Canon BubbleJet 800: /etc/apsfilterrc.bjc800). The pre-installed versions of these files contain commented-out sample entries for all standard variables. In the global /etc/apsfilterrc, the meaning of each variable is also explained in detailed commentaries, well-worth reading . . . The variables themselves, in the printer-specific files, are the same as in the global /etc/apsfilterrc, and are numbered in order (by commentaries; currently 6.2, from 0 to 12). The apsfilter for each job first reads in the global, and then the printer-specific, apsfilterrc: If there is any doubt, the settings in the latter have priority. Thus you can make normal settings in /etc/apsfilterrc (for example, for printer resolution), and yet replace these default settings for specific printers with other specifically customized values. Changes to the apsfilterrc files take effect immediately. Instead of reproducing the entire /etc/apsfilterrc, we will just men- tion the most frequently used variables: * FEATURE and USE RECODE NOT A2PS control the filtering of ASCII- files (already described on page 299). * REMOTE PRINTER is used for the pre-filtering of jobs for network print- ers. If this is set to true, jobs in the relevant printer queues will be sent to the special remote printer queues after they have been filtered. If you select a different value, this will be interpreted as the name of the remote printer. See Section 12.4 on the following page. 6 How to use less is described in Section 19.7.3 page 434 303 12. Printers * PRINT RAW SETUP PRINTER is available in case an escape se- quence is needed to initialize the printer for jobs in the raw printer queue. Its contents are sent to the printer before a raw printer job. /etc/apsfilterrc includes an example, as well as syntax details. * GS RESOL allows you to set a different resolution for the Ghostscript filter than was originally configured for the printer. * DO ACCOUNTING should be set to yes if an accounting file is to be cre- ated. At the same time you must write the entry :la@: instead of :la: in the /etc/printcap; then the file defined by af will be supplied with information. In order to be able to use this feature, you should use the program plp; replace the package lprold with the package plpn. User-specific settings: The version of apsfilter in SuSE Linux also sup- ports your own /.apsfilterrc in your home directory. This is evaluated after the system-wide apsfilterrc files, and can therefore overwrite these settings. For security reasons ­ evaluations are made with the permissions of the printer daemon which is running ­ only those directions in /.apsfilterrc will be obeyed which set one of the following variables to a new value: TEXINPUTS, PRINT DVI, GS FEATURES, USE RECODE NOT A2PS, FEATURE, A2PS OPTS, DVIPS MODE, GS RESOL.7 All other directions there will be ignored. If you need a HOME/.apsfilterrc, then you should copy the system- wide apsfilterrc files there and edit them to your requirements. 12.4 Network Printers with apsfilter A network printer with its own TCP/IP network interface is regarded by the BSD-Spooling-System as a remote host with its own printer queues (for their names: see the printer handbook, often LPT1, etc.) As such, it can, without further ado, be addressed by a remote printer queue, for example, with the name remote, by the local computer. If, however, you need a filter for the printing job, things are complicated by the fact that the printer daemon lpd (package lprold) does not perform any pre-filtering for remote printer queues, and also ignores filtering details in the /etc/printcap. Therefore jobs for this remote printer queue must already contain printer-specific data; this can be achieved with pre-filtering, by means of the "bypass" feature of the SuSE-version of the apsfilter. If you configure this with YaST, a little adjustment by hand is necessary; The SETUP program is somewhat more convenient. Start SETUP, then, as described above in Section 12.3 page 301 pp.; you will then be asked for the `DEVICE'(cf. page 302): PARALLEL Parallel printer interface SERIAL Serial printer interface PREFILTER to another queue (bypass) REMOTE printer forwarding queue 7 See the variable allowed in /var/lib/apsfilter/apsfilter. 304 12.5. Some Words on Ghostscript 1. First you should create a printer queue with `REMOTE', which refers to the remote network printer: then you are asked for the remote host to which the printer is connected, (in this example: helios), and for the remote printer there (as a rule: lp ­ but if in doubt, check with your network administrator!) The definition of the remote printer queue is not complete; don't forget to actually install this printer queue by pressing `ADD' . . . The entry in the /etc/printcap should now appear as shown in the File contents 12.4.1. remote|lp1|helios-lp|helios lp:\ :lp=:\ :rm=helios:\ :rp=lp:\ :sd=/var/spool/lpd/helios-lp:\ :lf=/var/spool/lpd/helios-lp/log:\ :af=/var/spool/lpd/helios-lp/acct:\ :ar:bk:mx#0:\ :sh: File contents 12.4.1: /etc/printcap: Network printer 2. Now it is the turn of the "local pre-filtering". This time when you are asked for `DEVICE', you should select the item `PREFILTER'. SETUP is now intelligent enough to suggest the previously installed net- work printer: remote remote=helios queue=lp You can take care of the rest as if you wanted to set up a nor- mal local printer; cf. above, page 302 pp. When you finally press on `ADD', you will find, in addition to /etc/apsfilterrc (cf. File contents 12.3.2 page 301), a new file by the name of /etc/apsfilterrc. (here in the example in /etc/apsfilterrc.bjc800), with the entry: REMOTE_PRINTER="remote" This entry refers to the network printer; if there are several network print- ers, the names of the printers in the net are used instead of "remote"8. Cf. the graphical representation of such a configuration (Figure 12.1 on the following page). 12.5 Some Words on Ghostscript If you don't own a PostScript printer, Ghostscript is the most popular choice for a filter. Ghostscript accepts PostScript files and contains many printer drivers for conversion purposes. Ghostscript (gs) is an extensive tool with many command line options. If you invoke Ghostscript from the command 8 If you configure with YaST this entry must be "enabled" by hand, and you should make sure that you specify /dev/null as the device. 305 12. Printers lpr -Praw lpd apsfilter lpd /dev/lpX lpr (auto) # lpr -Pascii bypass lpr -Psun lpd ethernet lpd auf sun /dev/lpX filter for lp Figure 12.1: Remote printing via bypass line, it presents you with its own dialog, GS. You can leave this by entering quit. Unfortunately, there is not enough space to cover all the gory details.9 Anyway, we want to point out the very helpful help command: newbie@earth: > gs -h | less which lists all possible options as well as the (important!) version number and the current list of supported devices. We have printed this list, current at the time of going to press, in Section 12.6 on the next page. If you encounter any difficulties, it might be helpful to invoke Ghostscript with a printable PostScript (.ps) file and to send the constructed printer- specific data directly to the device. A summary of suitable PostScript files can be found at /usr/share/ghostscript//examples or /var/lib/apsfilter/test. The command for invoking Ghostscript, for example, for the included printer driver necp6 using a 360×360 resolution, and sending it to the printer, might look like this: 9 An initial overview can be found in Ghostscript's manpage. Fortunately, apsfilter releases you from the tedious construction of command line options. 306 12.6. List of Supported Printers newbie@earth: > gs -q -dNOPAUSE -dSAFER -sDEVICE=necp6 \ -r360x360 -sOutputFile=testfile.lpr testfile.ps GS> quit newbie@earth: > su earth: # cat testfile.lpr >/dev/lp0 If you use the uniprint driver with a parameter file, the correct commands (for a Stylus printer) would be: newbie@earth: > gs @stc.upp -q -dNOPAUSE -dSAFER \ -r360x360 -sOutputFile=testfile.lpr test- file.ps quit.ps newbie@earth: > su earth: # cat testfile.lpr > /dev/lp0 Hint: you can find helpful documentation on many new printers in /usr/share/ghostscript//doc (e. g., in devices. txt). On the Ghostscript-Homepage you will find the most up-to-date information on Ghostscript (versions, printer support, etc.). It is located at: http:// www.cs.wisc.edu/ ghost/. 12.6 List of Supported Printers Apart from PostScript, HP DeskJet and Epson Stylus printers, a whole se- ries of other printers are supported by Ghostscript (status: version 5.10); since version 5 the "uniprint" driver is new, which in each case is adjusted with one printer-specific parameter file for the desired printer. These parameter files can also be selected with lprsetup and you can make your own customizations, if required; they are located in /usr/share/ghostscript// and have the extension .upp. So you should first try out these parameter files (Table 12.1 page 309), in as far as they are available for the printer model. Canon bjc610a0.upp BJC 610, 360x360DPI, plain paper high speed, color, rendered bjc610a1.upp BJC 610, 360x360DPI, plain paper, color, rendered bjc610a2.upp BJC 610, 360x360DPI, coated paper, color, ren- dered bjc610a3.upp BJC 610, 360x360DPI, transparency film, color, rendered bjc610a4.upp BJC 610, 360x360DPI, back print film, color, ren- dered bjc610a5.upp BJC 610, 360x360DPI, fabric sheet, color, rendered bjc610a6.upp BJC 610, 360x360DPI, glossy paper, color, ren- dered Table 12.1: continued overleaf. . . ... 307 12. Printers bjc610a7.upp BJC 610, 360x360DPI, high gloss film, color, ren- dered bjc610a8.upp BJC 610, 360x360DPI, high resolution paper, color, rendered bjc610b1.upp BJC 610, 720x720DPI, plain paper, color, rendered bjc610b2.upp BJC 610, 720x720DPI, coated paper, color, ren- dered bjc610b3.upp BJC 610, 720x720DPI, transparency film, color, rendered bjc610b4.upp BJC 610, 720x720DPI, back print film, color, ren- dered bjc610b6.upp BJC 610, 720x720DPI, glossy paper, color, ren- dered bjc610b7.upp BJC 610, 720x720DPI, high gloss paper, color, ren- dered bjc610b8.upp BJC 610, 720x720DPI, high resolution paper, color, rendered Hewlett-Packard cdj550.upp DeskJet 550c, 300x300DpI, Gamma=2 NEC necp2x.upp Prinwriter 2X, 360x360DPI, Plain Paper necp2x6.upp Prinwriter 2X, 360x360DPI, Plain Paper Epson stc.upp Stylus Color I (and PRO Series), 360x360DPI, Plain Paper stc h.upp Stylus Color I (and PRO Series), 720x720DPI, Spe- cial Paper stc l.upp Stylus Color I (and PRO Series), 360x360DPI, noWeave stc1520h.upp Stylus Color 1520, 1440x720DPI, inkjet paper stc2.upp Stylus Color II / IIs, 360x360DPI, plain paper stc2 h.upp Stylus Color II, 720x720DPI, special paper stc2s h.upp Stylus Color IIs, 720x720DPI, special paper stc500p.upp Stylus Color 500, 360x360DPI, not weaved, plain paper stc500ph.upp Stylus Color 500, 720x720DPI, not weaved, plain paper stc600ih.upp Stylus Color 600, 1440x720DPI, inkjet paper stc600p.upp Stylus Color 600, 720x720DPI, plain paper Table 12.1: continued overleaf. . . ... 308 12.6. List of Supported Printers stc600pl.upp Stylus Color 600, 360x360DPI, plain paper stc800ih.upp Stylus Color 800, 1440x720DPI, inkjet paper stc800p.upp Stylus Color 800, 720x720DPI, plain paper stc800pl.upp Stylus Color 800, 360x360DPI, plain paper stcany.upp Any Stylus Color, 360x360DPI Table 12.1: Parameter files for the uniprint driver (Ghostscript 5.10) If you cannot find any parameter files for your particular model, then try the proven "drivers" in the table 12.2 page 311. Apple appledmp Apple Dot Matrix Printer (also Imagewriter) iwhi Apple Imagewriter, high resolution iwlo Apple Imagewriter, low resolution iwlq Apple Imagewriter, 320x216 dpi Canon bj10e BubbleJet 10e bj200 BubbleJet 200 bjc600 BubbleJet 600c, 4000c (color) bjc800 BubbleJet 800c (color) lbp8 LBP-8II lips3 LIPS III DEC declj250 LJ 250 la50 LA50 la70 LA70 la75 LA75 la75plus LA75 Plus lj250 LJ250 ln03 LN03 Epson ap3250 AP3250 eps9high FX-80-compatible, 240 dpi eps9mid FX-80-compatible, 120 dpi Table 12.2: continued overleaf. . . ... 309 12. Printers epson FX-80-compatible 9 or 24-pin printer epsonc LQ-2550, Fujitsu 1200/2400/3400, color lp8000 LP-8000 laser printer lq850 LQ-850, 24-pin printer, 360dpi st800 Stylus 800, ESC/P2 stcolor Stylus Color Hewlett-Packard cdeskjet DeskJet 500C, black & white cdj500 DeskJet 500C, 540C cdj550 DeskJet 550C, 560C cdj670 DeskJet 670C, 690C cdj850 DeskJet 850C, 855C, 870C, 1100C cdj890 DeskJet 890C cdj1600 DeskJet 1600C cdjcolor DeskJet 500C, color print cdjmono DeskJet 500C, black & white deskjet DeskJet, DeskJet Plus djet500 DeskJet 500 djet500c DeskJet 500c djet820c DeskJet 820Cse and 820Cxi; poss. also the 1000 models dnj650c DesignJet 650C hpdj DeskJet with PCL-3 support (color and black & white) Ghostscript-docu: hpdj/gs-hpdj.txt laserjet LaserJet ljet2p LaserJet IIp ljet3 LaserJet III ljet3d LaserJet IIID ljet4 LaserJet IV ljetplus LaserJet Plus lj4dith LaserJet IV, dithered lj5mono LaserJet 5 & 6 (PCL XL), bitmap lj5gray LaserJet 5 & 6, grayscale bitmap lp2563 2563B Line Printer paintjet PaintJet color printer pj PaintJet XL, alternative pjetxl PaintJet 300XL pjxl PaintJet 300XL pjxl300 PaintJet 300XL, DeskJet 1200C IBM Table 12.2: continued overleaf. . . ... 310 12.6. List of Supported Printers ibmpro Proprinter, 9-pin jetp3852 Jetprinter 3852 OKI oki182 MicroLine 182 okiibm MicroLine, IBM-compatible Tektronix t4693d2 4693d, color t4693d4 4693d, color t4693d8 4693d, color tek4696 4695/4696 Others hl7x0 Brother 720, 730, 820 imagen Imagen ImPress m8510 C.Itoh M8510 necp6 NEC P6, P6+, P60 at 360 dpi oce9050 OCE 9050 r4081 Ricoh 4081 laser printer sj48 StarJet 48 cp50 Mitsubishi CP50 color xes Xerox XES (2700, 3700, 4045) Table 12.2: Supported printers (Ghostscript 5.10) All HP4 compatible PostScript printers are also supported. During the installation of apsfilter or during configuration using YaST, the line given in the left column has to be set as the printer device (e. g.djet500). If the printer is not supported, this does not necessarily mean that the aps- filter can not be used. In this case, try a similar printer. Quite often this driver can also be used. Additional help in selecting a driver can be found in the CDB Component Database of the SuSE hardware database: http: //cdb.suse.de/cdb_english.html or locally, if you have installed the package cdb, series doc. There are numerous printers on the market which are labelled "for Win- dows"; another frequently used name is "GDI printer". Such printers can often not be used at all in Linux, or with limitations, if you are lucky; have a look at the CDB in http://cdb.suse.de/cdb_english.html or ask your hardware dealer! 311 12. Printers A software converter especially for such HP DeskJets is available for black and white printing (package ppa, series ap); to install it, please read the documentation in usr/doc/packages/ppa or the article ke_printer-gdi.html in http://sdb.suse.de/sdb/en/html For Lexmark printers (models 5700, 7000 and 7200) there is the package pbm2l7k, series ap; the documentation can be found in /usr/doc/ packages/pbm2l7k. Setting the wrong resolution is quite a common error. If this is the case, the correct value (a DPI rate the printer accepts) can be set in GS RESOL in /etc/apsfilterrc (e. g., GS RESOL=360x360). Some entries (com- mented) already exist. 12.7 Printer Checklist: apsfilter * Is the package aps, series ap for the apsfilter installed? * Was apsfilter configured with YaST or /var/lib/apsfilter/ SETUP? * Are package net tool, package netcfg, package nkita, package nkitb (alle series a) installed? Is package lprold from series n in- stalled? * Does the kernel have support for TCP/IP? This can be seen form the message "IP protocols: ICMP, UDP, TCP" in /var/log/ boot.msg. * Is the support for parallel ports activated? ­ ­ Is the lp module really loaded? In the 2.2.xx kernel the modules parport and parport pc also need to be loaded (refer to Sec- tion 10.4.3 page 267 pp.). ­ If you have a "Plug-and-Play" BIOS, and if the port configuration in the BIOS of your computer is set to auto, then you should assign it an explicit address (the standard one is: 0x0378 or just 378). ­ If the printer just "blinks", then the port in the BIOS may be configured to the value ECP+EPP, which is not recognized by the printer. If this is the case, change this value to normal, SPP or ECP. * If the printer doesn't support the standard resolution of 300×300 dpi: was the correct printer resolution (according to the printer manual) configured with YaST or set in /etc/apsfilterrc? * What is the output of the command lpc status? * Try the command lpc up all. * At least the raw printer queue should work for all printers and allow ASCII-files to be printed; "GDI printers" are an exception to this (see above, on the page before). * If the printer prints in landscape form and you don't want this, then you should take a look at page 300. * If you use the option-P with the command lpr, there must not be a space before the printer name. 312 12.7. Printer Checklist: apsfilter * If you can print ASCII text via the "raw" printer queue, then try and print out a normal PostScript file with lpr. You can either generate such a Postscript file from ASCII text, and then print it with the command: newbie@earth: > a2ps -nP -1 -p /etc/hosts > /var/tmp/hosts.ps newbie@earth: > lpr /var/tmp/hosts.ps or you can use one of the files supplied with Ghostscript: newbie@earth: > lpr /usr/share/ghostscript/5.10/examples/tiger.ps * Check the log files in /var/spool/lpd/DRIVER_NAME; DRIVER_ NAME must be replaced by the name of your own printer. * Make sure you are using the correct printer port (see Section 12.1 page 293) * The kernel must not contain any PLIP drivers (/var/log/boot.msg)! 313 12. Printers 314