1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<html> 3<head> 4<title>Setting up a Unix lpr filter for Ghostscript</title> 5<!-- $Id: Unix-lpr.htm,v 1.39 2005/10/20 19:46:23 ray Exp $ --> 6<!-- Originally: unix-lpr.txt --> 7<link rel="stylesheet" type="text/css" href="gs.css" title="Ghostscript Style"> 8</head> 9 10<body> 11<!-- [1.0 begin visible header] ============================================ --> 12 13<!-- [1.1 begin headline] ================================================== --> 14 15<h1>Setting up a Unix <tt>lpr</tt> filter for Ghostscript</h1> 16 17<!-- [1.1 end headline] ==================================================== --> 18 19<!-- [1.2 begin table of contents] ========================================= --> 20 21<h2>Table of contents</h2> 22 23<blockquote><ul> 24<li><a href="#Overview">Overview</a> 25<li><a href="#What_it_can_do">What it can do</a> 26<li><a href="#Setting_up">Setting it up</a> 27<ul> 28<li><a href="#Editing_device_list">Editing the device list <b><tt>DEVICES</tt></b></a> 29<ul> 30<li><a href="#Field_bpp">Field 1: bits per pixel</a> 31<li><a href="#Field_colours">Field 2: colours</a> 32<li><a href="#Field_dq">Field 3: dual queues</a> 33<li><a href="#Device_example">Example definition of <b><tt>DEVICES</tt></b></a> 34</ul> 35<li><a href="#Editing_filter_list">Editing the filter list</a> 36<li><a href="#Editing_printer_port">Editing the printer port and type</a> 37<li><a href="#Modifying_printcap_insert">Modifying <b><tt>printcap.insert</tt></b></a> 38<li><a href="#Multiple_queues">Single or dual queues</a> 39</ul> 40<li><a href="#Bugs">Bugs</a> 41<li><a href="#Authors">Authors</a> 42</ul></blockquote> 43 44<!-- [1.2 end table of contents] =========================================== --> 45 46<!-- [1.3 begin hint] ====================================================== --> 47 48<p>For other information, see the <a href="Readme.htm">Ghostscript 49overview</a> and the <a href="Use.htm">usage documentation</a>. 50 51<!-- [1.3 end hint] ======================================================== --> 52 53<hr> 54 55<!-- [1.0 end visible header] ============================================== --> 56 57<!-- [2.0 begin contents] ================================================== --> 58 59<h2><a name="Overview"></a>Overview</h2> 60 61<p> 62"How do I set up Ghostscript to provide PostScript queues in a standard lpr 63environment on Unix systems?" is a Frequently Asked Question amongst 64Ghostscript users. The two shell scripts described by this document are 65designed to make this task a little easier. They are 66 67<blockquote><dl> 68<dt><b><tt>unix-lpr.sh</tt></b> 69<dd>a flexible, multi-option print filter 70 71<dt><b><tt>lprsetup.sh</tt></b> 72<dd>A shell script which sets up soft links and creates a template insert 73for the <b><tt>printcap</tt></b> file 74</dl></blockquote> 75 76<hr> 77 78<h2><a name="What_it_can_do"></a>What it can do</h2> 79 80<p> 81The print filter resides in the Ghostscript installation directory (often 82<b><tt>/usr/local/share/ghostscript</tt></b>, but may be something else at 83your installation), together with a dummy filter directory containing 84various soft links which point to the filter. It offers the following 85features: 86 87<ul> 88<li>Multiple devices supported by a single filter 89<li>Multiple bit-depths for the same device 90<li>Multiple number of colours for the same device 91<li>Direct (single-queue) and indirect (two-queue) setup 92<li>Support for the standard preprocessing filters if you have the 93corresponding (whatever)-to-PostScript translators 94<li>Redirection of diagnostic and programmed output to a logfile in 95the spooling directory 96<li>Maintaining of printer accounting records of the numbers of pages 97printed by each user (compatible with the <b><tt>pac</tt></b> command) 98<li>Straightforward editing for further customisation 99</ul> 100 101<hr> 102 103<h2><a name="Setting_up"></a>Setting it up</h2> 104 105<p> 106The <b><tt>lprsetup.sh</tt></b> script needs to have two lines edited 107before running, to set the printer devices to use and the list of filters 108available. With this information, it 109 110<ul> 111<li>creates a "<b><tt>filt</tt></b>" subdirectory under the 112Ghostscript installation directory 113<li>creates the links in this directory which enable the filter to 114determine the parameters for running Ghostscript 115<li>automatically generates <b><tt>printcap</tt></b> entries which should 116need only a little editing before adding to your system 117<b><tt>printcap</tt></b> file 118</ul> 119 120<h3><a name="Editing_device_list"></a>Editing the device list <tt>DEVICES</tt></h3> 121 122<p> 123At the top of <b><tt>lprsetup.sh</tt></b> is a line of the form 124<b><tt>DEVICES=</tt></b><em>{list}</em>. Replace the example list with 125your own list of devices. Each entry is the name of a device, followed by 126three more optional fields, separated by dots "<b><tt>.</tt></b>". 127 128<h4><a name="Field_bpp"></a>Field 1: bits per pixel</h4> 129 130<p> 131The first field is required only if the printer device understands the <a 132href="Devices.htm#deskjet_parameters"><b><tt>-dBitsPerPixel=</tt></b> 133switch</a>, which applies only to colour devices. For a particular number 134<b><em>N</em></b> of bits per pixel, add the suffix <b><em>.N</em></b> to 135the device name, for instance <b><tt>cdj500.3</tt></b>, 136<b><tt>cdj500.24</tt></b>, etc. 137 138<h4><a name="Field_colours"></a>Field 2: colours</h4> 139 140<p> 141The second field is required only if the printer device understands the 142setting of the <b><tt>Colors</tt></b> device parameter (as in 143<b><tt>-dColors=</tt></b>), which applies only to colour devices (and at 144present is only supported by the <b><tt>bjc</tt></b>* family of drivers). 145For a particular number <b><em>N</em></b> of colours, suffix 146<b><em>.N</em></b> to the device name, such as <b><tt>bjc600.24.3</tt></b>, 147<b><tt>bjc600.8.1</tt></b> etc. 148 149<h4><a name="Field_dq"></a>Field 3: dual queues</h4> 150 151<p> 152The third field is required in order to use two separate queues for the 153device, a "raw" queue and a PostScript queue (see 154"<a href="#Multiple_queues">Single or dual queues</a>" below). If you want 155dual queues, add the suffix <b><tt>.dq</tt></b> ("dual queue") to the name, 156whether or not a <a href="#Field_bpp">bits-per-pixel suffix</a> has already 157been added. 158 159<h4><a name="Device_example"></a>Example definition of 160<tt>DEVICES</tt></h4> 161 162<p> 163Thus the following list supports a <b><tt>cdj550</tt></b> device at three 164different bit depths (24 bpp, 3 bpp and 1 bpp), with a dual queue (that is, 165a separate queue for the raw data); a monochrome <b><tt>deskjet</tt></b> 166device with a single queue; and a <b><tt>djet500</tt></b> device using a 167separate queue: 168 169<blockquote><b><tt> 170DEVICES="cdj550.24.dq cdj550.3.dq cdj550.1.dq deskjet djet500.dq" 171</tt></b></blockquote> 172 173<h3><a name="Editing_filter_list"></a>Editing the filter list</h3> 174 175<p> 176The standard list contains only the generic "<b><tt>if</tt></b>" filter, 177but a commented-out list shows other filters which may be available. If 178you wish to use the support for these filters, you may need to edit the 179<b><tt>bsd-if</tt></b> file to add to the <b><tt>PATH</tt></b> the 180directories where the translators are stored, or to change the names of the 181filters if yours are different. The <b><tt>bsd-if</tt></b> script is 182supplied with an example setup using Transcript (a commercial package from 183Adobe), and PBMPLUS, a freeware package by Jef Poskanzer and others. 184 185<h3><a name="Editing_printer_port"></a>Editing the printer port and 186type</h3> 187 188<p> 189You can set the port and port type (parallel or printer) for an attached 190printer, but for remote printers you'll have to modify the 191<tt>printcap.insert</tt> file yourself. 192 193<h3><a name="Modifying_printcap_insert"></a>Modifying 194<tt>printcap.insert</tt></h3> 195 196<p> 197Running <b><tt>lprsetup.sh</tt></b> generates a file 198<b><tt>printcap.insert</tt></b> which has a template setup for your 199printer queues. It cannot guarantee to do the whole job, and you will 200probably need to consult your system documentation and edit this file 201before you add it to your <b><tt>printcap</tt></b> file. The file has good 202defaults for serial printers, as these often cause problems in getting 203binary data to the printer. However, you may need to change the baud rate, 204or the handshaking method. Only a small change is required in the 205<b><tt>printcap</tt></b> file to use a networked remote printer instead of 206an attached printer, and an example is given in 207<b><tt>printcap.insert</tt></b>. 208 209<h3><a name="Multiple_queues"></a>Single or dual queues</h3> 210 211<p> 212If you wish to provide a PostScript-only queue (for example, so that all 213pages printed go through accounting), and the printer port is local to the 214host machine, a single queue is appropriate -- Ghostscript simply converts 215PostScript into the printer's native data format and sends it to the 216port. But if the printer is on a remote networked machine, or if you need to 217send raw printer data to the printer, you must use two queues. Simply 218specify the <a href="#Field_dq">"<b><tt>.dq</tt></b>" option</a> above. 219 220<hr> 221 222<h2><a name="Bugs"></a>Bugs</h2> 223 224<p> 225You must have write access to the Ghostscript installation directory for 226<b><tt>lprsetup.sh</tt></b> to create the filter directory and soft links. 227 228<p> 229If you have several different values of bits per pixel for the same device, 230you must list all instances of that device as adjacent items in the 231<a href="#Editing_device_list"><b><tt>DEVICES</tt></b></a> device 232list. If you do not, <b><tt>printcap.insert</tt></b> will contain multiple 233entries for the same device, which is not supported. 234 235<hr> 236 237<h2><a name="Authors"></a>Authors</h2> 238 239<p> 240This material was contributed by George Cameron. Yves Arrouye 241<<a href="mailto:yves.arrouye@usa.net">yves.arrouye@usa.net</a>> 242is responsible for the number-of-colours part of the script. 243 244<!-- [2.0 end contents] ==================================================== --> 245 246<!-- [3.0 begin visible trailer] =========================================== --> 247<hr> 248 249<p> 250<small>Copyright © 1996, 1997, 1998 Aladdin Enterprises. All 251rights reserved.</small> 252 253<p> 254This software is provided AS-IS with no warranty, either express or 255implied. 256 257This software is distributed under license and may not be copied, 258modified or distributed except as expressly authorized under the terms 259of the license contained in the file LICENSE in this distribution. 260 261For more information about licensing, please refer to 262http://www.ghostscript.com/licensing/. For information on 263commercial licensing, go to http://www.artifex.com/licensing/ or 264contact Artifex Software, Inc., 101 Lucas Valley Road #110, 265San Rafael, CA 94903, U.S.A., +1(415)492-9861. 266 267<p> 268<small>Ghostscript version 8.53, 20 October 2005 269 270<!-- [3.0 end visible trailer] ============================================= --> 271 272</body> 273</html> 274