For other information, see the Ghostscript overview and the usage documentation.
"How do I set up Ghostscript to provide PostScript queues in a standard lpr environment on Unix systems?" is a Frequently Asked Question amongst Ghostscript users. The two shell scripts described by this document are designed to make this task a little easier. They are
- unix-lpr.sh
- a flexible, multi-option print filter
- lprsetup.sh
- A shell script which sets up soft links and creates a template insert for the printcap file
The print filter resides in the Ghostscript installation directory (often /usr/local/share/ghostscript, but may be something else at your installation), together with a dummy filter directory containing various soft links which point to the filter. It offers the following features:
The lprsetup.sh script needs to have two lines edited before running, to set the printer devices to use and the list of filters available. With this information, it
At the top of lprsetup.sh is a line of the form DEVICES={list}. Replace the example list with your own list of devices. Each entry is the name of a device, followed by three more optional fields, separated by dots ".".
The first field is required only if the printer device understands the -dBitsPerPixel= switch, which applies only to colour devices. For a particular number N of bits per pixel, add the suffix .N to the device name, for instance cdj500.3, cdj500.24, etc.
The second field is required only if the printer device understands the setting of the Colors device parameter (as in -dColors=), which applies only to colour devices (and at present is only supported by the bjc* family of drivers). For a particular number N of colours, suffix .N to the device name, such as bjc600.24.3, bjc600.8.1 etc.
The third field is required in order to use two separate queues for the device, a "raw" queue and a PostScript queue (see "Single or dual queues" below). If you want dual queues, add the suffix .dq ("dual queue") to the name, whether or not a bits-per-pixel suffix has already been added.
Thus the following list supports a cdj550 device at three different bit depths (24 bpp, 3 bpp and 1 bpp), with a dual queue (that is, a separate queue for the raw data); a monochrome deskjet device with a single queue; and a djet500 device using a separate queue:
DEVICES="cdj550.24.dq cdj550.3.dq cdj550.1.dq deskjet djet500.dq"
The standard list contains only the generic "if" filter, but a commented-out list shows other filters which may be available. If you wish to use the support for these filters, you may need to edit the bsd-if file to add to the PATH the directories where the translators are stored, or to change the names of the filters if yours are different. The bsd-if script is supplied with an example setup using Transcript (a commercial package from Adobe), and PBMPLUS, a freeware package by Jef Poskanzer and others.
You can set the port and port type (parallel or printer) for an attached printer, but for remote printers you'll have to modify the printcap.insert file yourself.
Running lprsetup.sh generates a file printcap.insert which has a template setup for your printer queues. It cannot guarantee to do the whole job, and you will probably need to consult your system documentation and edit this file before you add it to your printcap file. The file has good defaults for serial printers, as these often cause problems in getting binary data to the printer. However, you may need to change the baud rate, or the handshaking method. Only a small change is required in the printcap file to use a networked remote printer instead of an attached printer, and an example is given in printcap.insert.
If you wish to provide a PostScript-only queue (for example, so that all pages printed go through accounting), and the printer port is local to the host machine, a single queue is appropriate -- Ghostscript simply converts PostScript into the printer's native data format and sends it to the port. But if the printer is on a remote networked machine, or if you need to send raw printer data to the printer, you must use two queues. Simply specify the ".dq" option above.
You must have write access to the Ghostscript installation directory for lprsetup.sh to create the filter directory and soft links.
If you have several different values of bits per pixel for the same device, you must list all instances of that device as adjacent items in the DEVICES device list. If you do not, printcap.insert will contain multiple entries for the same device, which is not supported.
This material was contributed by George Cameron. Yves Arrouye <yves.arrouye@usa.net> is responsible for the number-of-colours part of the script.
Copyright © 1996, 1997, 1998 Aladdin Enterprises. All rights reserved.
This software is provided AS-IS with no warranty, either express or implied. This software is distributed under license and may not be copied, modified or distributed except as expressly authorized under the terms of the license contained in the file LICENSE in this distribution. For more information about licensing, please refer to http://www.ghostscript.com/licensing/. For information on commercial licensing, go to http://www.artifex.com/licensing/ or contact Artifex Software, Inc., 101 Lucas Valley Road #110, San Rafael, CA 94903, U.S.A., +1(415)492-9861.
Ghostscript version 8.11, 16 August 2003