Unix-lpr.htm 13.7 KB
Newer Older
1
<!doctype html>
2 3
<html>
<head>
4 5 6 7 8 9 10 11
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-54391264-2"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-54391264-2');
12
</script>
13 14 15
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro" rel="stylesheet">
16
<link rel="shortcut icon" type="image/png" href="../../images/favicon.png">
17
<title>Setting Up a Unix 1pr Filter for Ghostscript</title>
18
    <!-- Originally: unix-lpr.txt -->
19 20
<link href="style.css" rel="stylesheet" type="text/css">
<link href="gs-style.css" rel="stylesheet" type="text/css">
21 22 23
</head>

<body>
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45

    <div class="header">
    <div class="row">
        <div class="col-lt-6 logo"><a href="https://www.ghostscript.com/"><img src="images/ghostscript_logo.png" width="108" height="119" alt=""></a></div>
        <div class="col-6"><div class="row"><div class="artifexlogo"><a href="https://artifex.com" target="_blank"><img src="images/Artifex_logo.png" width="194" height="40" alt=""></a></div>
        <div class="col-12"><div class="button button1"><a href="https://artifex.com/contact-us/" title="Contact Us" target="_blank">Contact Us</a></div>
        <div class="button button2 hidden-xs"><a href="https://www.ghostscript.com/download.html" title="Download">Download</a></div></div></div>
    </div>
    </div>
    </div>

    <div class="banner">
    <div class="row">
        <div class="col-12">Setting Up a Unix 1pr Filter for Ghostscript</div>
    </div>
    </div>

    <div class="main">
    <div class="row">
    <div id="sidebar">
    <div class="sidebar-item"></div>
    <div class="col-2 leftnav">
46
<ul>
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
            <li><a href="https://www.ghostscript.com/">Home</a></li>
            <li><a href="https://www.ghostscript.com/license.html">Licensing</a></li>
            <li><a href="https://www.ghostscript.com/releases.html">Releases</a></li>
            <li><a href="https://www.ghostscript.com/release_history.html">Release History</a></li>
            <li><a href="https://www.ghostscript.com/documentation.html" title="Documentation">Documentation</a></li>
            <li><a href="https://www.ghostscript.com/download.html" title="Download">Download</a></li>
            <li><a href="https://www.ghostscript.com/performance.html" title="Performance">Performance</a></li>
            <li><a href="http://jbig2dec.com/" title="jbig2dec">jbig2dec</a></li>
            <li><a href="http://git.ghostscript.com/?p=ghostpdl.git;a=summary">Source</a></li>
            <li><a href="http://bugs.ghostscript.com/">Bugs</a></li>
            <li><a href="https://www.ghostscript.com/faq.html" title="FAQ">FAQ</a></li>
        </ul>
    </div>
    </div>
    <div class="col-10 page">

63
<!--START EDITING HERE-->
64 65 66 67

<h2>Table of contents</h2>

<blockquote><ul>
68 69 70
<li><a href="#Overview">Overview</a></li>
<li><a href="#What_it_can_do">What it can do</a></li>
<li><a href="#Setting_up">Setting it up</a></li>
71
<ul>
72
<li><a href="#Editing_device_list">Editing the device list <code>DEVICES</code></a></li>
73
<ul>
74 75 76 77
<li><a href="#Field_bpp">Field 1: bits per pixel</a></li>
<li><a href="#Field_colours">Field 2: colours</a></li>
<li><a href="#Field_dq">Field 3: dual queues</a></li>
<li><a href="#Device_example">Example definition of <code>DEVICES</code></a></li>
78
</ul>
79 80 81 82
<li><a href="#Editing_filter_list">Editing the filter list</a></li>
<li><a href="#Editing_printer_port">Editing the printer port and type</a></li>
<li><a href="#Modifying_printcap_insert">Modifying <code>printcap.insert</code></a></li>
<li><a href="#Multiple_queues">Single or dual queues</a></li>
83
</ul>
84 85
<li><a href="#Bugs">Bugs</a></li>
<li><a href="#Authors">Authors</a></li>
86 87 88 89 90 91 92
</ul></blockquote>

<!-- [1.2 end table of contents] =========================================== -->

<!-- [1.3 begin hint] ====================================================== -->

<p>For other information, see the <a href="Readme.htm">Ghostscript
93
overview</a> and the <a href="Use.htm">usage documentation</a>.</p>
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108

<!-- [1.3 end hint] ======================================================== -->

<hr>

<!-- [1.0 end visible header] ============================================== -->

<!-- [2.0 begin contents] ================================================== -->

<h2><a name="Overview"></a>Overview</h2>

<p>
"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
109
designed to make this task a little easier. They are</p>
110 111

<blockquote><dl>
112 113
<dt><code>unix-lpr.sh</code></dt>
<dd>a flexible, multi-option print filter</dd>
114

115
<dt><code>lprsetup.sh</code></dt>
116
<dd>A shell script which sets up soft links and creates a template insert
117
for the <code>printcap</code> file</dd>
118 119 120 121 122 123 124 125 126 127 128
</dl></blockquote>

<hr>

<h2><a name="What_it_can_do"></a>What it can do</h2>

<p>
The print filter resides in the Ghostscript installation directory (often
<code>/usr/local/share/ghostscript</code>, 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
129
features:</p>
130 131

<ul>
132 133 134 135
<li>Multiple devices supported by a single filter</li>
<li>Multiple bit-depths for the same device</li>
<li>Multiple number of colours for the same device</li>
<li>Direct (single-queue) and indirect (two-queue) setup</li>
136
<li>Support for the standard preprocessing filters if you have the
137
corresponding (whatever)-to-PostScript translators</li>
138
<li>Redirection of diagnostic and programmed output to a logfile in
139
the spooling directory</li>
140
<li>Maintaining of printer accounting records of the numbers of pages
141 142
printed by each user (compatible with the <code>pac</code> command)</li>
<li>Straightforward editing for further customisation</li>
143 144 145 146 147 148 149 150 151
</ul>

<hr>

<h2><a name="Setting_up"></a>Setting it up</h2>

<p>
The <code>lprsetup.sh</code> script needs to have two lines edited
before running, to set the printer devices to use and the list of filters
152
available. With this information, it</p>
153 154 155

<ul>
<li>creates a "<code>filt</code>" subdirectory under the
156
Ghostscript installation directory</li>
157
<li>creates the links in this directory which enable the filter to
158
determine the parameters for running Ghostscript</li>
159 160
<li>automatically generates <code>printcap</code> entries which should
need only a little editing before adding to your system
161
<code>printcap</code> file</li>
162 163 164 165 166 167 168 169
</ul>

<h3><a name="Editing_device_list"></a>Editing the device list <tt>DEVICES</tt></h3>

<p>
At the top of <code>lprsetup.sh</code> is a line of the form
<code>DEVICES=</code><em>{list}</em>.  Replace the example list with
your own list of devices.  Each entry is the name of a device, followed by
170
three more optional fields, separated by dots "<code>.</code>".</p>
171 172 173 174 175 176 177 178 179

<h4><a name="Field_bpp"></a>Field 1: bits per pixel</h4>

<p>
The first field is required only if the printer device understands the <a
href="Devices.htm#deskjet_parameters"><code>-dBitsPerPixel=</code>
switch</a>, which applies only to colour devices. For a particular number
<b><em>N</em></b> of bits per pixel, add the suffix <b><em>.N</em></b> to
the device name, for instance <code>cdj500.3</code>,
180
<code>cdj500.24</code>, etc.</p>
181 182 183 184 185 186 187 188 189 190

<h4><a name="Field_colours"></a>Field 2: colours</h4>

<p>
The second field is required only if the printer device understands the
setting of the <code>Colors</code> device parameter (as in
<code>-dColors=</code>), which applies only to colour devices (and at
present is only supported by the <code>bjc</code>* family of drivers).
For a particular number <b><em>N</em></b> of colours, suffix
<b><em>.N</em></b> to the device name, such as <code>bjc600.24.3</code>,
191
<code>bjc600.8.1</code> etc.</p>
192 193 194 195 196 197 198 199 200

<h4><a name="Field_dq"></a>Field 3: dual queues</h4>

<p>
The third field is required in order to use two separate queues for the
device, a "raw" queue and a PostScript queue (see
"<a href="#Multiple_queues">Single or dual queues</a>" below).  If you want
dual queues, add the suffix <code>.dq</code> ("dual queue") to the name,
whether or not a <a href="#Field_bpp">bits-per-pixel suffix</a> has already
201
been added.</p>
202 203 204 205 206 207 208 209 210

<h4><a name="Device_example"></a>Example definition of
<tt>DEVICES</tt></h4>

<p>
Thus the following list supports a <code>cdj550</code> 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 <code>deskjet</code>
device with a single queue; and a <code>djet500</code> device using a
211
separate queue:</p>
212 213 214 215 216 217 218 219 220 221 222

<blockquote><code>
DEVICES="cdj550.24.dq&nbsp;cdj550.3.dq&nbsp;cdj550.1.dq&nbsp;deskjet&nbsp;djet500.dq"
</code></blockquote>

<h3><a name="Editing_filter_list"></a>Editing the filter list</h3>

<p>
The standard list contains only the generic "<code>if</code>" 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
223
<code>bsd-if</code> file to add to the <code>PATH</code> the
224 225 226
directories where the translators are stored, or to change the names of the
filters if yours are different.  The <code>bsd-if</code> script is
supplied with an example setup using Transcript (a commercial package from
227
Adobe), and PBMPLUS, a freeware package by Jef Poskanzer and others.</p>
228 229 230 231 232 233 234

<h3><a name="Editing_printer_port"></a>Editing the printer port and
type</h3>

<p>
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
235
<tt>printcap.insert</tt> file yourself.</p>
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250

<h3><a name="Modifying_printcap_insert"></a>Modifying
<tt>printcap.insert</tt></h3>

<p>
Running <code>lprsetup.sh</code> generates a file
<code>printcap.insert</code> 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 <code>printcap</code> 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
<code>printcap</code> file to use a networked remote printer instead of
an attached printer, and an example is given in
251
<code>printcap.insert</code>.</p>
252 253 254 255 256 257 258 259 260 261

<h3><a name="Multiple_queues"></a>Single or dual queues</h3>

<p>
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
262
specify the <a href="#Field_dq">"<code>.dq</code>" option</a> above.</p>
263 264 265 266 267 268 269

<hr>

<h2><a name="Bugs"></a>Bugs</h2>

<p>
You must have write access to the Ghostscript installation directory for
270
<code>lprsetup.sh</code> to create the filter directory and soft links.</p>
271 272 273 274 275 276

<p>
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
<a href="#Editing_device_list"><code>DEVICES</code></a> device
list.  If you do not, <code>printcap.insert</code> will contain multiple
277
entries for the same device, which is not supported.</p>
278 279 280 281 282 283 284 285

<hr>

<h2><a name="Authors"></a>Authors</h2>

<p>
This material was contributed by George Cameron.  Yves Arrouye
&lt;<a href="mailto:yves.arrouye@usa.net">yves.arrouye@usa.net</a>&gt;
286
is responsible for the number-of-colours part of the script.</p>
287 288 289 290 291 292 293

<!-- [2.0 end contents] ==================================================== -->

<!-- [3.0 begin visible trailer] =========================================== -->
<hr>

<p>
294
<small>Copyright &copy; 2000-2019 Artifex Software, Inc.  All rights reserved.</small>
295 296 297 298 299 300 301 302

<p>
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 that
license.  Refer to licensing information at http://www.artifex.com/
303 304
or contact Artifex Software, Inc.,  1305 Grant Avenue - Suite 200,
Novato, CA 94945, U.S.A., +1(415)492-9861, for further information.
305 306

<p>
307
<small>Ghostscript version 9.28, 15 August 2019
308 309

<!-- [3.0 end visible trailer] ============================================= -->
310

311 312

<!--FINISH EDITING HERE-->
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342

    </div>
    </div>
    </div>

    <div class="footer">
    <div class="row">
        <div class="col-7 footleft">
        <ul>
            <li><a href="https://artifex.com/contact-us/" target="blank">CONTACT US</a></li>
            <li><a href="https://artifex.com/about-us/" target="blank">ABOUT</a></li>
            <li><a href="https://ghostscript.com/security.html">SECURITY</a></li>
        </ul>
        </div>
        <div class="col-1 footcenter">
         <ul>
           <li><a href="https://artifex.com/support/" target="blank">SUPPORT</a></li>
           <li><a href="https://artifex.com/blog/artifex/" target="blank">BLOG</a></li>
           <li><a href="https://artifex.com/privacy-policy/" target="blank">PRIVACY</a></li>
           </ul>
        </div>
        <div class="col-ft-3 footright"><img src="images/Artifex_logo.png" width="194" height="40" alt=""/> <br>
              © Copyright 2019 Artifex Software, Inc. <br>
            All rights reserved.
        </div>
          </div>
    </div>

    <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
    <script src="index.js"></script>
343 344
</body>
</html>