[567] | 1 | # $Id$ |
---|
| 2 | |
---|
[576] | 3 | Tea4CUPS : Tee for CUPS |
---|
[567] | 4 | |
---|
[3559] | 5 | (c) 2005-2013 Jerome Alet <alet@librelogiciel.com> |
---|
[642] | 6 | (c) 2005 Peter Stuge <stuge-tea4cups@cdy.org> |
---|
[567] | 7 | This program is free software; you can redistribute it and/or modify |
---|
| 8 | it under the terms of the GNU General Public License as published by |
---|
| 9 | the Free Software Foundation; either version 2 of the License, or |
---|
| 10 | (at your option) any later version. |
---|
| 11 | |
---|
| 12 | This program is distributed in the hope that it will be useful, |
---|
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 15 | GNU General Public License for more details. |
---|
| 16 | |
---|
| 17 | You should have received a copy of the GNU General Public License |
---|
| 18 | along with this program; if not, write to the Free Software |
---|
[644] | 19 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
[567] | 20 | |
---|
| 21 | ============================================================================= |
---|
| 22 | |
---|
[644] | 23 | Tea4CUPS resembles the *nix command 'tee', but is a CUPS backend. |
---|
[567] | 24 | |
---|
[576] | 25 | Tea4CUPS behaves just like any other CUPS backend, but allows you to |
---|
[3438] | 26 | modify print jobs' datas as they pass through it and to transparently |
---|
[659] | 27 | send them to any number of outputs : other CUPS backends, files or pipes. |
---|
[567] | 28 | |
---|
| 29 | This for example allows you to output the same print job on several |
---|
| 30 | printers at the same time, which is not possible with CUPS. |
---|
| 31 | |
---|
[645] | 32 | Another possibility would be for example to send the same document to |
---|
[567] | 33 | a printer, a PDF generator, a Fax, and as an attachment to an email |
---|
| 34 | message, all of this by printing it a single time. |
---|
| 35 | |
---|
[645] | 36 | Tea4CUPS allows this by permitting you to easily plug your own |
---|
| 37 | commands into the very last stage of CUPS' filtering chain. |
---|
[598] | 38 | |
---|
[659] | 39 | Tea4CUPS provides three ways to launch commands : |
---|
[644] | 40 | |
---|
[659] | 41 | - filters : A filter can modify the input datas before they |
---|
| 42 | are sent to the printer or made available to |
---|
| 43 | the pre and post hooks defined below. |
---|
| 44 | Currently a single filter can be defined |
---|
| 45 | per print queue. |
---|
| 46 | |
---|
[645] | 47 | - prehooks : these are guaranteed to be launched before the |
---|
[598] | 48 | print job is sent to the real printer. |
---|
[645] | 49 | Any prehook which exits -1 can cancel the |
---|
[659] | 50 | print job. Any number of prehooks can be |
---|
| 51 | defined for a particular print queue. |
---|
[645] | 52 | |
---|
[598] | 53 | - posthooks : these are guaranteed to be launched after the |
---|
[603] | 54 | print job has been sent to the real printer, |
---|
| 55 | unless the job was previously cancelled by a |
---|
[3438] | 56 | prehook. Any number of posthooks can be |
---|
[659] | 57 | defined for a particular print queue. |
---|
[645] | 58 | |
---|
[586] | 59 | To help your own commands, Tea4CUPS makes available as part of the |
---|
[617] | 60 | environment several variables which can be used from the |
---|
[659] | 61 | commands you use in pre and post hooks : |
---|
[586] | 62 | |
---|
| 63 | TEAPRINTERNAME : The print queue name. |
---|
| 64 | TEADIRECTORY : Tea4CUPS output directory. |
---|
| 65 | TEADATAFILE : Full name of Tea4CUPS work file (in $TEADIRECTORY). |
---|
| 66 | TEAJOBSIZE : Job's size in bytes. |
---|
| 67 | TEAMD5SUM : MD5 sum of the job's datas. |
---|
| 68 | TEACLIENTHOST : Client's hostname or IP address. |
---|
| 69 | TEAJOBID : Job's Id. |
---|
| 70 | TEAUSERNAME : Name of the user who launched the print job. |
---|
| 71 | TEATITLE : Job's title. |
---|
| 72 | TEACOPIES : Number of copies requested. |
---|
| 73 | TEAOPTIONS : Options of the print job. |
---|
| 74 | TEAINPUTFILE : Print job's data file or empty when job read from stdin. |
---|
[615] | 75 | TEABILLING : Job's billing code (lp -o job-billing=SomeCode file.ps) |
---|
| 76 | TEACONTROLFILE : Job's IPP message file (usually /var/spool/cups/c?????) |
---|
[645] | 77 | TEASTATUS : Original CUPS backend's exit code : ONLY AVAILABLE FROM |
---|
[603] | 78 | posthooks, obviously. |
---|
[645] | 79 | |
---|
[659] | 80 | None of these environment variables is available to filters. |
---|
[3438] | 81 | |
---|
[680] | 82 | NB : Tea4CUPS requires a version of Python >= 2.3 |
---|
[627] | 83 | |
---|
[567] | 84 | ============================================================================= |
---|
| 85 | |
---|
| 86 | Installation : |
---|
| 87 | -------------- |
---|
| 88 | |
---|
[591] | 89 | 0 - Download Tea4CUPS from : |
---|
[645] | 90 | |
---|
[669] | 91 | http://www.pykota.com/software/tea4cups |
---|
[645] | 92 | |
---|
| 93 | and extract it : |
---|
| 94 | |
---|
[592] | 95 | $ tar -zxf tea4cups-x.yy.tar.gz |
---|
[645] | 96 | |
---|
[592] | 97 | where x.yy is Tea4CUPS' version number. |
---|
[645] | 98 | |
---|
| 99 | 1 - Copy the 'tea4cups' command into CUPS' backend directory, |
---|
[567] | 100 | for example : |
---|
[645] | 101 | |
---|
[576] | 102 | $ cp tea4cups /usr/lib/cups/backend |
---|
[3438] | 103 | |
---|
[674] | 104 | If you use CUPS v1.2 or higher you must do this as well : |
---|
[3438] | 105 | |
---|
[673] | 106 | $ chown root.root /usr/lib/cups/backend/tea4cups |
---|
| 107 | $ chmod 700 /usr/lib/cups/backend/tea4cups |
---|
[645] | 108 | |
---|
[644] | 109 | 2 - Restart CUPS in order for this new backend to be detected. |
---|
| 110 | NB : For this to work you need CUPS 1.1.15 or higher. |
---|
| 111 | You can use Tea4CUPS with older versions if you want, but |
---|
| 112 | without autodetection. |
---|
[645] | 113 | |
---|
| 114 | 3 - Either from CUPS' web interface, add new printers with |
---|
[576] | 115 | 'Tea4CUPS managed' in front of the device's name. |
---|
[645] | 116 | |
---|
[674] | 117 | Or by directly modifying CUPS' printers.conf file, or with |
---|
| 118 | the lpadmin command line tool, just prepend each DeviceURI |
---|
[3438] | 119 | value with 'tea4cups://'. If you modified printers.conf |
---|
| 120 | directly instead of using lpadmin then don't forget to |
---|
[680] | 121 | restart CUPS. |
---|
[644] | 122 | (Use this last method if autodetection doesn't work because |
---|
| 123 | the version of CUPS you use is too old) |
---|
[645] | 124 | |
---|
| 125 | 4 - Copy tea4cups.conf into CUPS' configuration directory (where |
---|
[567] | 126 | cupsd.conf resides) : |
---|
[645] | 127 | |
---|
[576] | 128 | $ cp tea4cups.conf /etc/cups/ |
---|
[645] | 129 | |
---|
| 130 | 5 - Modify tea4cups.conf to suit your needs. Several examples |
---|
[567] | 131 | are included. |
---|
[645] | 132 | |
---|
| 133 | 6 - There's no 6 ! |
---|
| 134 | |
---|
[567] | 135 | ============================================================================= |
---|
| 136 | |
---|
[645] | 137 | Troubleshooting : |
---|
[567] | 138 | ----------------- |
---|
| 139 | |
---|
[680] | 140 | 1 - Set "LogLevel debug2" and "MaxLogSize 0" in CUPS' cupsd.conf |
---|
[645] | 141 | |
---|
[567] | 142 | 2 - Restart CUPS. |
---|
[645] | 143 | |
---|
[576] | 144 | 3 - Set "debug: yes" in the [global] section of tea4cups.conf |
---|
[645] | 145 | |
---|
[567] | 146 | 4 - Print something on a print queue managed |
---|
[576] | 147 | by Tea4CUPS. |
---|
[645] | 148 | |
---|
[567] | 149 | 5 - Look at CUPS' error_log file for diagnostic and error messages. |
---|
[645] | 150 | |
---|
[567] | 151 | ============================================================================= |
---|
[591] | 152 | |
---|
[645] | 153 | CUPS (Common UNIX(r) Printing System) is trademark property of Easy Software |
---|
[591] | 154 | Products. |
---|
| 155 | |
---|
| 156 | You can download CUPS from : |
---|
| 157 | |
---|
| 158 | http://www.cups.org |
---|
| 159 | |
---|
| 160 | ============================================================================= |
---|
[645] | 161 | |
---|
[3382] | 162 | Please report any problem to the bug tracker at http://trac.pykota.com |
---|