1lpfilter(1M)            System Administration Commands            lpfilter(1M)
2
3
4

NAME

6       lpfilter - administer filters used with the LP print service
7

SYNOPSIS

9       /usr/sbin/lpfilter -f filter-name
10            {- | -i | -l | -x | -F pathname}
11
12

DESCRIPTION

14       The  lpfilter  command is used to add, change, delete, or list a filter
15       used with the LP print service. These  filters convert the content of a
16       file to have a content type acceptable to a printer.
17

OPTIONS

19       Arguments  consist  of  the -ffilter-name option and exactly one of the
20       arguments appearing within braces ({}) in the SYNOPSIS.
21
22       Adds or changes a filter as specified  from  standard
23                         input. The format of the input is specified below. If
24                         -f all is specified with the  option, the specified
25                         change  is  made to all existing filters. This is not
26                         useful.
27
28
29       -f filter-name    Specifies the  filter-name of the filter to be added,
30                         changed,  reset, deleted, or listed. The  filter name
31                         all is a special filter name defined below.  The   -f
32                         option is required.
33
34
35       -F pathname       Adds or changes a filter as specified by the contents
36                         of the file pathname. The format of the  file's  con‐
37                         tents is specified below. If -f all is specified with
38                         the -F option, the specified change is  made  to  all
39                         existing filters. This is not useful.
40
41
42       -i                Resets  a  filter  to its default settings. Using  -f
43                         all with the  -i option  restores   all  filters  for
44                         which  predefined  settings  are  available  to their
45                         original settings.
46
47
48       -l                Lists a filter description. Using -f all with the  -l
49                         option produces a list of all filters.
50
51
52       -x                Deletes  a  filter.  Using  -f all with the -x option
53                         results in all filters being deleted.
54
55

USAGE

57   Adding or Changing a Filter
58       The filter named in the -f option is added to the filter table. If  the
59       filter  already  exists,  its description is changed to reflect the new
60       information in the input.
61
62
63       When  is specified, standard input supplies the  filter  description.
64       When  -F  is  specified, the file pathname supplies the filter descrip‐
65       tion. One of these two options must be specified to  add  or  change  a
66       filter.
67
68
69       When  an  existing  filter is changed with the -F or option, lines in
70       the filter description that are not specified in  the  new  information
71       are not changed. When a new filter is added with this  command, unspec‐
72       ified lines receive default values. See below.
73
74
75       Filters are used to convert the content  of a request from its  initial
76       type  into  a  type acceptable to a printer. For a given print request,
77       the LP print service knows the following:
78
79           o      The content type of the request  (specified  by   lp  -T  or
80                  determined implicitly).
81
82           o      The name of the printer (specified by  lp -d).
83
84           o      The printer type (specified by lpadmin -T).
85
86                  The printer type is intended to be a printer model, but some
87                  people specify it with a content type even though lpadmin -I
88                  is intended for this purpose.
89
90           o      The  content  types  acceptable to the printer (specified by
91                  lpadmin -I).
92
93                  The values specified by the lpadmin -T  are  treated  as  if
94                  they were specified by the -I option as well.
95
96           o      The  modes  of  printing  asked for by the originator of the
97                  request (specified by various options to lp).
98
99
100       The system uses the above information to construct a list  of   one  or
101       more  filters  that converts the document's content type into a content
102       type acceptable to the printer  and  consumes  all  lp  arguments  that
103       invoke filters  (-y and -P).
104
105
106       The  contents  of  the  file (specified by the -F option) and the input
107       stream from standard input (specified by  ) must consist of  a  series
108       of  lines,  such that each line conforms to the syntax specified by one
109       of the seven lines below. All lists are comma or space separated.  Each
110       item contains a description.
111
112         Input types: content-type-list
113         Output types: content-type-list
114         Printer types: printer-type-list
115         Printers: printer-list
116         Filter type: filter-type
117         Command: shell-command
118         Options: template-list
119
120
121
122       Input types      This  gives  the content types that can be accepted by
123                        the filter. The default is any. The  document  content
124                        type  must   be  a member of this list for the initial
125                        filter in the sequence.
126
127
128       Output types     This gives the content types that the filter can  pro‐
129                        duce  from  any  of  the  input  (content) types.  The
130                        default is any. The intersection of the  output  types
131                        of  this  list and the content types acceptable to the
132                        printer (from lpadmin -I and lpadmin -T) must be  non-
133                        null  for  the last filter in the sequence.  For adja‐
134                        cent filters in the sequence, the intersection of out‐
135                        put  types of one and the input types of the next must
136                        be non-null.
137
138
139       Printer types    This gives the printer types for which  this   printer
140                        can  be  used.  The LP print service will restrict the
141                        use of  the filter to these printer types (from  lpad‐
142                        min -T). The default is any.
143
144
145       Printers         This  gives  the  names  of the printers for which the
146                        filter can be used. The LP print service will restrict
147                        the  use of the filter to just the printers named. The
148                        default is any.
149
150
151       Filter type      This marks the filter as a slow filter or a fast  fil‐
152                        ter. Slow filters are generally those that take a long
153                        time to convert  their  input  (that  is,  minutes  or
154                        hours). They are run before the job is scheduled for a
155                        printer, to keep  the  printers  from  being  tied  up
156                        while  the  filter is running.  If a listed printer is
157                        on a remote system, the filter type for it  must  have
158                        the value slow. That is, if a client defines a filter,
159                        it must be a slow filter. Fast filters  are  generally
160                        those  that  convert  their  input  quickly  (that is,
161                        faster than the printer  can  process  the  data),  or
162                        those  that must be connected to the printer when run.
163                        Fast filters will be given to the interface program to
164                        run while connected  to the physical printer.
165
166
167       Command          This specifies which program to run to invoke the fil‐
168                        ter. The  full  program  pathname  as  well  as  fixed
169                        options  must  be included in the shell-command; addi‐
170                        tional options are constructed, based on  the  charac‐
171                        teristics  of  each  print  request and on the Options
172                        field. A command must be given for  each  filter.  The
173                        command  must  accept  a data stream as standard input
174                        and produce the converted data stream on its  standard
175                        output. This allows filter pipelines to be constructed
176                        to convert data not handled by a single filter.
177
178
179       Options          This is a comma-separated list of  templates  used  by
180                        the  LP print service to construct options to the fil‐
181                        ter from the  characteristics of  each  print  request
182                        listed  in  the table later. The -y and  - P arguments
183                        to the lp command cause a filter sequence to be  built
184                        even  if  there is no need for a conversion of content
185                        types.
186
187                        In general, each template is of the following form:
188
189                        keyword pattern = replacement
190
191                        The keyword names the characteristic that the template
192                        attempts  to  map  into a filter-specific option; each
193                        valid keyword is listed in the table below.
194
195                        A pattern is one of the following:  a literal  pattern
196                        of  one  of  the  forms  listed in the table, a single
197                        asterisk (*), or a  regular  expression.  If   pattern
198                        matches  the value of the characteristic, the template
199                        fits and is used to generate a filter-specific option.
200                        The  replacement is what will be used as the option.
201
202                        Regular expressions are the same as those found on the
203                        regexp(5) manual page. This includes the  \(...\)  and
204                        \n  constructions,  which  can be used to extract por‐
205                        tions of the pattern for copying into the replacement,
206                        and  the  &, which can be used to copy the entire pat‐
207                        tern into the replacement.
208
209                        The replacement can also  contain  a  *;  it  too,  is
210                        replaced  with  the entire pattern, just like the & of
211                        regexp(5).
212
213
214
215       The keywords are:
216
217         lp Option          Characteristic   keyword         Possible patterns
218
219         -T                Content type      INPUT           content-type
220                           (input)
221
222         Not applicable    Content type      OUTPUT          content-type
223                           (output)
224
225         not applicable    Printer type      TERM            printer-type
226
227         -d                Printer name      PRINTER         printer-name
228
229         -f, -o cpi=       Character pitch   CPI             integer
230
231         -f, -o lpi=       Line pitch        LPI             integer
232
233         -f, -o length=    Page length       LENGTH          integer
234
235         -f, -o width=     Page width        WIDTH           integer
236
237         -P                Pages to print    PAGES           page-list
238
239         -S                Character set     CHARSET         character-set-name
240                           Print wheel       CHARSET         print-wheel-name
241
242         -f                Form name         FORM            form-name
243
244         -y                Modes             MODES           mode
245
246         -n                Number of         COPIES          integer
247                           copies
248
249
250
251   Resetting a Filter to Defaults
252       If the filter named is one originally  delivered  with  the   LP  print
253       service, the -i option restores the original filter description.
254
255   Deleting a Filter
256       The   -x  option is used to delete the filter  specified in filter-name
257       from the LP filter table.
258
259   Listing a Filter Description
260       The  -l option is used to list the description of the filter  named  in
261       filter-name.  If  the  command is  successful, the following message is
262       sent to standard output:
263
264         Input types: content-type-list
265         Output types: content-type-list
266         Printer types: printer-type-list
267         Printers: printer-list
268         Filter type: filter-type
269         Command: shell-command
270         Options: template-list
271
272
273
274
275       If the command fails, an error message is sent to standard error.
276
277   Large File Behavior
278       See largefile(5) for the description of the behavior of  lpfilter  when
279       encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
280

EXAMPLES

282       Example 1 Printing with the landscape option
283
284
285       For example, the template
286
287
288         MODES landscape = -l
289
290
291
292
293       shows  that  if  a  print  request  is  submitted with the -y landscape
294       option, the filter will be given the option -l.
295
296
297       Example 2 Selecting the printer type
298
299
300       As another example, the template
301
302
303         TERM * = -T *
304
305
306
307
308       shows that the filter will be given  the  option  -T  printer-type  for
309       whichever   printer-type  is  associated with a print request using the
310       filter.
311
312
313       Example 3 Using the keywords table
314
315
316       Consider the template
317
318
319         MODES prwidth\=\(.*\) = -w\1
320
321
322
323
324       Suppose a user gives the command
325
326
327         lp -y prwidth=10
328
329
330
331
332       From the table above, the LP  print  service  determines  that  the  -y
333       option  is  handled by a MODES template. The  MODES template here works
334       because the  pattern prwidth=) matches the  prwidth=10  given  by   the
335       user.  The replacement -w1 causes the  LP print service to generate the
336       filter option -w10. If necessary, the LP print service will construct a
337       filter  pipeline  by concatenating several filters to handle the user's
338       file and all the print options. See  sh(1) for a description of a pipe‐
339       line.  If the print service constructs a filter pipeline, the INPUT and
340       OUTPUT values used for each filter in the pipeline  are  the  types  of
341       input and output for that  filter, not for the entire pipeline.
342
343

EXIT STATUS

345       The following exit values are returned:
346
347       0           Successful completion.
348
349
350       non-zero    An error occurred.
351
352

ATTRIBUTES

354       See attributes(5) for descriptions of the following attributes:
355
356
357
358
359       ┌─────────────────────────────┬─────────────────────────────┐
360       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
361       ├─────────────────────────────┼─────────────────────────────┤
362       │Availability                 │SUNWpsu                      │
363       └─────────────────────────────┴─────────────────────────────┘
364

SEE ALSO

366       lp(1), sh(1), lpadmin(1M), attributes(5), largefile(5), regexp(5)
367
368
369
370

NOTES

372       If the lp command specifies more than one document, the filtering chain
373       is determined by the first document. Other documents may have a differ‐
374       ent  format,  but they will print correctly only if the filter chain is
375       able to handle their format.
376
377
378
379SunOS 5.11                        3 Apr 1997                      lpfilter(1M)
Impressum