If you only ever print from Windows clients, you will probably not have any printing problems. In that case you can stop reading here.
If, however, you want to print from the command line or a script with a simple 'lpr
' command, read on. Likewise, if you'd like to print to a non-PostScript printer (aka a regular PC printer) through papd, the AppleTalk print server, continue reading.
To illustrate why you need an input filter, try this:
$ lpr -P%printer input.txt
where %printer is the name of a printer on your system, and "input.txt" is a Unix text file. Maybe a very old line printer will produce the desired output, but most printers will print one and a half lines of text and a lot of empty lines. For those printers you'll have to filter the input through an lpd input filter to add carriage returns and form feeds. A simple input filter would suffice for that, but you'd only be able to print Unix text files. To print other types of files, you could use specific input filters to handle those file types, or you could use a so-called magic print filter.
A magic print filter is a catch-all input filter with automatic file type handling capabilities. It can determine the file type of the input and decide what kind of filtering/processing is required. Most magic print filters use PostScript as an intermediate file type. PostScript is the de facto standard for printable documents and is natively supported by professional-grade printers. On Linux and other Unices it is also supported by a whole slew of utilities and converters and a very powerful piece of software called ghostscript, which enables a wide variety of devices, including many consumer-grade printers, to be used as PostScript output devices. Ghostscript effectively turns your non-PostScript printer into a PostScript printer (without actually improving the printing quality, of course).
Apsfilter is a PostScript/ghostscript magic print filter. It is generally considered a powerful and mature print filter. It uses conversion utilities such as a2ps and pdf2ps to convert input to PostScript and uses ghostscript to print to the output device, your printer. It does all this automatically and transparently. All you need to do is issue a simple 'lpr
' command, and apsfilter will take care of the rest. For example:
$ lpr -Ppingo input.txt input.pdf input.ps
will print the text file "input.txt", the PDF file "input.pdf" and the PostScript file "input.ps" to the printer "pingo".
These three input types, text, PDF, and PostScript, are the file types that you'll be able to print if you follow the installation instructions below. For any other file types you'll need to install additional PostScript converters, such as html2ps to print HTML files from the command line, or rtf2ps to print RTF files. These converters require that you install quite a few additional libraries, though, and printing HTML and RTF files from the command line is not our aim. Our aim is to print PostScript print jobs to a non-PostScript printer transparently, i.e. with a simple 'lpr
' command.
The standard print command for papd in SME Linux is lpr -P%printer input
"
Papd registers all printers in the system as PostScript printers. This means that AppleTalk clients see all printers as PostScript printers. The PostScript driver on the AppleTalk client will convert print jobs to PostScript and the client will send it to papd. With apsfilter and ghostscript installed, the papd printer will be able to print these PostScript print jobs even if the printer is a non-PostScript printer.
Apsfilter does not interfere with Windows printing. The print command for Samba, the Windows print server, is lpr -b -P%printer input
"-b
"
================================================================== A P S F I L T E R S E T U P -- MAIN MENUE -- ================================================================== (D) Available Device Drivers in your gs binary (R) Read Ghostscript driver documentation (devices.txt) (1) Printer Driver Selection [] (2) Interface Setup [] (3) Paper Format [] (4) Printing Quality [medium] (5) Color Mode [full] (6) Print Resolution in "dots per inch" [300x300] (7) Default Printing Method [auto] (A) Abort installation (don't do anything) (Q) ==> Finish installation Your choice?
================================================================ PRINTER DRIVER SELECTION ================================================================ Please select the type of printer you want to install: 1) PostScript printer (generic) 2) PostScript printer (with ghostscript drivers) 3) printer driver natively supported by ghostscript 4) gimp-print / stp 5) hpdj 6) pcl3 (successor to hpdj) 7) IBM Omni 8) various HP Deskjet drivers 9) PPA printer 10) official HP DeskJet drivers (hpijs 0.97) 11) official HP DeskJet drivers (hpijs 1.0) 12) Epson printer (official drivers) 13) Lexmark inkjet printer 14) miscellaneous other drivers 15) non-printer devices (caution! -- read the handbook) 0) return to main menu Your choice:
================================================================== A P S F I L T E R S E T U P -- MAIN MENUE -- ================================================================== (D) Available Device Drivers in your gs binary (R) Read Ghostscript driver documentation (devices.txt) (1) Printer Driver Selection [deskjet] (2) Interface Setup [parallel] (3) Paper Format [a4] (4) Printing Quality [medium] (5) Color Mode [full] (6) Print Resolution in "dots per inch" [300x300] (7) Default Printing Method [auto] (T) Print Test Page (V) View performance log (times of print attempts) (A) Abort installation (don't do anything) (I) ==> Install printer with values shown above - repeat this step for installing multiple printers (Q) ==> Finish installation Your choice?
Please enter a printer queue name for printer 'deskjet'. The default name is 'lp'. Your choice:
{ use esmith::db # process all accounts my %accounts; tie %accounts, 'esmith::config', '/home/e-smith/accounts'; my @printers = grep { db_get_type(\%accounts, $_) eq 'printer' } keys %accounts; $OUT = ""; foreach my $printer ( @printers ) { $OUT .= "\n"; $OUT .= $printer; $OUT .= "|" . db_get_prop(\%accounts, $printer, 'Description') . ":\\\n"; $OUT .= "\t:server:\\\n"; $OUT .= "\t:mx#0:\\\n"; $OUT .= "\t:sh:\\\n"; $OUT .= "\t:ff_separator=false:\\\n"; $OUT .= "\t:sd=/var/spool/lpd/$printer:\\\n"; add---> #begin apsfilter add---> $OUT .= "\t:if=/etc/apsfilter/basedir/bin/apsfilter:\\\n"; add---> #end apsfilter if (db_get_prop(\%accounts, $printer, 'Location') eq 'remote') { $OUT .= "\t:rm=" . db_get_prop(\%accounts, $printer, 'Address') . ":\\\n"; # no trailing backslash for last entry if (db_get_prop(\%accounts, $printer, 'RemoteName')) { $OUT .= "\t:rp=" . db_get_prop(\%accounts, $printer, 'RemoteName') . ":\n"; } else { $OUT .= "\t:rp=raw:\n"; } } else { # no trailing backslash for last entry $OUT .= "\t:lp=/dev/" . db_get_prop(\%accounts, $printer, 'Location') . ":\n"; } } }
Open the Chooser, select 'LaserWriter 8'. Your printer should now show up as a 'PostScript Printer'. Set it up as a 'Generic' PostScript printer.
The command to print files from the SME Server is lpr -P%printer
"lpr -Ppingo
"
lpr -P%printer input.html
"alpha | i386 | ||
---|---|---|---|
ghostscript-6.51-16es2.alpha.rpm | ghostscript-6.51-16es2.i386.rpm | ||
ghostscript-fonts-5.50-3.noarch.rpm | ghostscript-fonts-5.50-3.noarch.rpm | ||
urw-fonts-2.0-12es2.noarch.rpm | urw-fonts-2.0-12es2.noarch.rpm | ||
apsfilter-7.2.5-1rvda.noarch.rpm | apsfilter-7.2.5-1rvda.noarch.rpm | ||
SME/Alpha V5.5 | 5.0/5.1 | 5.5 | 5.6 |
a2ps-4.13b-15.alpha.rpm | a2ps | a2ps | a2ps |
psutils-1.17-13.alpha.rpm | psutils | psutils | psutils |
Package sources | |||
apsfilter-7.2.5-1rvda.src.rpm | |||
The other sources can be found in Charlie Brady's contrib area and on RedHat's ftp servers. |