![]() |
James Thornton |
| Internet Business Consultant |
| Home | Blog | Bio | Projects | Contact | Latest Blog (new site): How to Get to Genius |
|---|
|
8.12 Advanced Printing TopicsThe FreeBSD UNIX LPR/LPD printing system is very flexible, and, with the addition of filters, can be adapted to very unusual printing environments. To enhance this flexibility, several useful printing utilities are supplied on the FreeBSD CDROM which the administrator might wish to install. 8.12.1 GhostscriptThe Ghostscript program, invoked as /usr/local/bin/gs, is one of the most useful printing utilities that have been developed for the free software community. Ghostscript reads incoming PostScript data, (or Adobe PDF files) interprets it, and outputs it as a raster image. This can be displayed on screen, for example, with the GhostView program under the X Window system, or printed on most graphics printers, such as Epson dot-matrix, HP DeskJet, or HP LaserJet. In effect, it is a way of adding PostScript printing capability to a printer that doesn't have PostScript firmware code. Ghostscript has been ported to numerous operating systems including Windows. The Ghostscript home page is located at http://www.cs.wisc.edu/~ghost/ and contains the most current version of the program. A prebuilt FreeBSD binary of Ghostscript is located in the Packages section of the FreeBSD CDROM. This can be installed on the FreeBSD system by selecting the package from the prepackaged software list that is accessed through the /stand/sysinstall installation program. Many packaged programs on the CD depend on GhostScript, and so it may already be installed. Installation of the packaged version of GhostScript is recommended in the FreeBSD ports Section because it has been tested with the other packages that require it. The package creates a directory containing some documentation files in /usr/local/share/ghostscript/X.XX/doc. Unfortunately, because of the packaging process on the FreeBSD CDROM not all the useful installation files are copied into this location. So, if the package was version 5.03 (for example) the administrator will also want to get the file ftp://ftp.cs.wisc.edu/ghost/aladdin/gs503/ghostscript-5.03.tar.gz, and unzip and untar it into a temporary directory. Extracting the archive file creates a directory structure under the gs5.03 subdirectory. To install ghostscript in the /etc/printcap file, read the gs5.03/devs.mak file to determine which printer driver definition works with your printer and then use the following instructions:
8.12.2 a2ps filterAnother handy utility is the a2ps filter, short for ASCII-to-PostScript. This program takes an incoming ASCII datastream and converts it into PostScript. It can also print multiple pages on a single sheet of paper by shrinking them down. It is a useful tool for a printer that cannot interpret ASCII, such as a PostScript-only printer. A2ps is not installed in the FreeBSD system by default; it is located in the ports section /usr/ports/print/a2ps43. A prepackaged binary can be installed with /stand/sysinstall but I have had problems with that port. It is best to install it by running make in the a2ps43 ports directory. A printcap entry and filter using this follow: Example 8-3. /etc/printcap
#
lp|local line printer with output dumped through a2ps for raw listings:\
:lp=/dev/lpt0:sd=/var/spool/output/lpd:lf=/var/log/lpd-errs:sh:mx#0:\
:if=/usr/local/libexec/ascii2postscript:
#
Example 8-4. /usr/local/libexec/ascii2postscript
#!/bin/sh
#
# Simple filter that converts ASCII to PostScript for basic stuff like
# directory listings.
#
/usr/local/bin/a2ps && exit 0
exit 2
Read the system manual page for a2ps to see the options available with this program, and remember to set the filter script ascii2postscript all-executable. This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/. For questions about FreeBSD, read the
documentation
before contacting <questions@FreeBSD.org>. |
|
James Thornton, jamesthornton.com>Services: Linux Programmer |
Electric Speed: Search Engine Submission Ranking And Optimization |