Unix-lpr.htm 10 KB

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