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