• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//
2// PPD file compiler test data file for CUPS.
3//
4// Copyright © 2020-2024 by OpenPrinting.
5// Copyright © 2007-2011 by Apple Inc.
6// Copyright © 1997-2003 by Easy Software Products.
7//
8// Licensed under Apache License v2.0.  See the file "LICENSE" for more
9// information.
10//
11
12/*
13 * C-style comments are supported.
14 */
15
16//
17// C++-style comments are supported.
18//
19
20//
21// Include the common media size definitions...
22//
23// #include directives support both <name> to include a standard file
24// and "name" or just name without the quotes for a local file.  Local
25// files resolve relative to the current file's path.  Unlike C/C++,
26// #include <name> does not look in multiple directories, and
27// #include "name" does not look in the standard directory.
28//
29
30#include <media.defs>
31
32
33//
34// Include the CUPS raster definitions...
35//
36
37#include <raster.defs>
38
39
40//
41// Include the standard CUPS fonts...
42//
43
44#include <font.defs>
45
46
47//
48// Define variables using the #define directive.  In this case we
49// are defining constants for the model number, which is used by
50// our imaginary rastertofoo filter to determine which model-specific
51// features to use/support.
52//
53
54#define MODEL_BW	0
55#define MODEL_COLOR	1
56
57#define MODEL_LASER	0
58#define MODEL_PHOTO	2
59
60
61//
62// Media sizes are defined using the #media directive.  The order of
63// values is: size name/text, width, length.
64//
65// "Size name" is an alphanumeric string of up to 40 characters as
66// defined by the Adobe PPD specification.
67//
68// "Size text" is a text string of up to 80 characters as defined by
69// the Adobe PPD specification.
70//
71// "Width" and "length" are the width and length of the media size.
72// Numbers by themselves represent points (72 points = 1 inch).  The
73// suffixes "cm", "ft", "in", "m", "mm", and "pt" are recognized to
74// specify centimeters, feet, inches, meters, millimeters, and points,
75// respectively.
76//
77
78#media "FooLetter/Foo Letter" 8in 10in
79#media "FooPhoto/Foo Photo" 200mm 300mm
80
81
82//
83// Message catalogs can be included using #po...
84//
85
86#po fr foo-fr.po
87
88
89//
90// Specify that the drivers use all of the standard base fonts...
91//
92
93Font *
94
95
96//
97// All copyright lines are put at the top of the PPD file in order
98// of their appearance.  Copyright text can span multiple lines and
99// will be properly included in the PPD file with comment prefixes
100// on each line.
101//
102// First an MIT-style copyright/license notice...
103//
104
105Copyright "Copyright 2007 by Foo Industries."
106Copyright "
107Permission is granted for redistribution of this file as long as
108this copyright notice is intact and the contents of the file are
109not altered in any way from their original form.
110
111Permission is hereby granted, free of charge, to any person
112obtaining a copy of this software and associated documentation
113files (the \"Software\"), to deal in the Software without
114restriction, including without limitation the rights to use,
115copy, modify, merge, publish, distribute, sublicense, and/or
116sell copies of the Software, and to permit persons to whom the
117Software is furnished to do so, subject to the following
118conditions:
119
120The above copyright notice and this permission notice shall be
121included in all copies or substantial portions of the Software.
122
123THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,
124EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
125OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
126NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
127HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
128WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
129FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
130OTHER DEALINGS IN THE SOFTWARE.
131"
132
133//
134// Then a GPL notice...
135//
136
137Copyright "Copyright 2007 by Foo Industries."
138Copyright "
139This software is free software; you can redistribute it and/or
140modify it under the terms of the GNU General Public License as
141published by the Free Software Foundation; either version 2 of
142the License, or (at your option) any later version.
143
144This software is distributed in the hope that it will be useful,
145but WITHOUT ANY WARRANTY; without even the implied warranty of
146MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
147GNU General Public License for more details.
148
149You should have received a copy of the GNU General Public
150License along with this software; if not, write to the Free
151Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
152MA 02111 USA
153"
154
155
156//
157// All printer drivers must define the manufacturer, model, PC
158// filename, and version strings; since this test file contains
159// drivers for an imaginary manufacturer "Foo", all of the drivers
160// listed in this file share common manufacturer and version
161// strings.
162//
163
164Manufacturer "Foo"
165Version 1.0
166
167
168//
169// Printer drivers can access driver-specific attributes in a PPD
170// file; these attributes are specified using lines of the form:
171//
172//     Attribute name selector value
173//
174// "Name" is the name of the attribute and should start with either
175// the "cups" prefix or the name of the vendor, e.g. "hpFoo",
176// "epsonBar", etc.  The name can be any alphanumeric character (a-z,
177// A-Z, and 0-9) and cannot be a common prefix of another attribute,
178// e.g. "fooLines" and "fooLinesPerInch" cannot be in the same file.
179//
180// "Selector" is a selector string containing any characters except
181// colon (:).  Typically this will be one or more keywords separated
182// by the forward slash (/), however the empty string ("") can be used
183// to omit the selector.
184//
185// "Value" is a quoted value string that can contain any printable
186// characters except the double quote (").  Hexadecimal numbers
187// inside angle brackets (<xx>) can be used to substitute escape
188// codes and other special characters.
189//
190
191Attribute fooOutputFormat "" "PCL"
192Attribute fooPJL Begin "<1B>%-12345X@PJL<0D0A>"
193Attribute fooPJL Enter/PCL "@PJL ENTER LANGUAGE=PCL<0D0A>"
194Attribute fooPJL End "<1B>%-12345X@PJL END JOB<0D0A>"
195
196//
197// Most printer drivers use filters; exceptions include PostScript
198// printers and PPD files for software RIPs.
199//
200// The format is:
201//
202//     Filter mime-type cost program
203//
204// The "mime-type" field defines the MIME type that the filter program
205// accepts; for CUPS raster printer drivers, this will be
206// "application/vnd.cups-raster".
207//
208// The "cost" field defines the relative cost of the filter in terms of
209// both CPU and memory usage, and is used to limit the number of
210// simultaneous jobs in some configurations.  Most raster filters should
211// have a cost of 100, unless the filter does no dithering - then a cost
212// of 33 is more appropriate.
213//
214// The "program" field defined the filter program to run; use the null
215// filter "-" to define a MIME type that the printer accepts directly.
216// If no path information is provided, then the program will be run
217// from the standard CUPS filter directory, usually
218// /usr/lib/cups/filter.
219//
220// When compiling PPD files for PostScript capable devices that use
221// additional filters, add a null filter for the MIME type
222// "application/vnd.cups-postscript" so that printer commands, user
223// job filters, and page markings can be added to the PostScript
224// output that is sent to the printer.
225//
226
227Filter application/vnd.cups-raster 100 rastertofoo
228
229
230//
231// Attributes are included thusly...
232//
233
234Attribute cupsIPPReason "com.foo-serious-error/A Serious Error" "http://foo.com/serious.html"
235
236
237//
238// Curley braces are used for grouping common data and for isolating
239// individual printer models.  All data values are inherited *except*
240// for the PCFilename and ModelName strings.
241//
242
243{
244  //
245  // Define two printer drivers that support only the FooLetter and
246  // FooPhoto media size.  One is color, the other is black-and-white.
247  //
248  // Both printers share two MediaSize definitions; the name listed
249  // after the MediaSize keyword must be one of the Adobe standard
250  // names listed in the PPD specification or any named size defined
251  // using the #media directive.
252  //
253  // Default options are indicated by placing an asterisk (*) before
254  // the keyword.
255  //
256  // For custom size and margin specification, see the next group of
257  // printer drivers.
258  //
259
260  MediaSize FooLetter
261  *MediaSize FooPhoto
262
263
264  //
265  // These imaginary printers support printing at 300, 600x300,
266  // and 600 DPI.  We'll use the old-style Resolution convenience
267  // keyword which accepts the following parameters: colorspace/
268  // order, bits-per-color, row count, row feed, row step, and
269  // name/text.
270  //
271  // The name must be of the form NNNsuffix or NNNxMMMsuffix,
272  // where NNN and MMM represent the X and Y resolution in dots
273  // per inch.
274  //
275
276  Resolution - 8 0 0 0 "300dpi/300 DPI"
277  Resolution - 8 0 0 0 "600x300dpi/600 x 300 DPI"
278  *Resolution - 8 0 0 0 "600dpi/600 DPI"
279
280
281  //
282  // One printer is grayscale only, and the other does grayscale
283  // and color.  Define the grayscale color model for both printers
284  // using the old-style ColorModel convenience keyword which
285  // accepts the name/text, colorspace, color order, and compression
286  // parameters.
287  //
288
289  ColorModel	Gray/Grayscale w chunked 0
290
291
292  {
293    //
294    // The first sub-group contains the grayscale printer, which
295    // only needs the model name, PC filename, and model number
296    // values set...
297    //
298    // The ModelName keyword defines the string that is shown to
299    // the user.
300    //
301
302    ModelName "Mono Photo Printer"
303
304
305    //
306    // The ModelNumber keyword defines the cupsModelNumber
307    // attribute value.  We use the "(name name)" notation
308    // to perform a bitwise OR of the #define'd constants.
309    //
310
311    ModelNumber ($MODEL_BW $MODEL_PHOTO)
312
313
314    //
315    // The PCFileName keyword defines the filename of the PPD
316    // file and should be 8 characters or less + the .ppd
317    // extension.
318    //
319
320    PCFileName "foogphot.ppd"
321  }
322
323
324  {
325    //
326    // The second sub-group contains the color printer, which
327    // needs another ColorModel definition along with the model
328    // name, PC filename, and model number values.  For fun, we'll
329    // add some input slots (paper trays) as well.
330    //
331    // The ModelName keyword defines the string that is shown to
332    // the user.
333    //
334
335    ModelName "Color Photo Printer"
336
337
338    //
339    // The ModelNumber keyword defines the cupsModelNumber
340    // attribute value.  We use the "(name name)" notation
341    // to perform a bitwise OR of the #define'd constants.
342    //
343
344    ModelNumber ($MODEL_COLOR $MODEL_PHOTO)
345
346
347    //
348    // The PCFileName keyword defines the filename of the PPD
349    // file and should be 8 characters or less + the .ppd
350    // extension.
351    //
352
353    PCFileName "foocphot.ppd"
354
355
356    //
357    // This printer does color printing, too, so add it and make
358    // RGB the default...
359    //
360
361    ColorDevice Yes
362
363    *ColorModel	RGB/Color rgb chunked 0
364
365
366    //
367    // The old-style InputSlot keyword accepts tray definitions
368    // of the form:
369    //
370    //    InputSlot position name/text
371    //
372
373    InputSlot 0 "Upper/Main Paper Tray"
374    InputSlot 1 "LargeCapacity/Large Paper Tray"
375  }
376}
377
378
379{
380  //
381  // Define two printer drivers that support two typical laser
382  // printers with custom page sizes.  One is color, the other is
383  // black-and-white.
384  //
385  // Both printers share several MediaSize definitions and support
386  // custom page sizes from 3x5 to 13x19 inches.
387  //
388  // All US media sizes use hardware margins of 0.25 inches on the sides
389  // and 12 points (1/6th inch) at the top and bottom.  European sizes
390  // and custom sizes use margins of 12 points all around.
391  //
392  // The order of the HWMargins numbers are left, bottom, right, and top.
393  // The current HWMargins values are used when defining each media size.
394  // The last HWMargins values are used for custom page size margins.
395  //
396
397  HWMargins 0.25in 12pt 0.25in 12pt
398
399  *MediaSize Letter
400  MediaSize Legal
401  MediaSize Tabloid
402  MediaSize TabloidExtra
403
404  HWMargins 12pt 12pt 12pt 12pt
405  MediaSize A4
406  MediaSize A3
407
408  //
409  // Specify that custom/variable paper sizes are supported, and the
410  // range of sizes that are supported...
411  //
412
413  VariablePaperSize Yes
414  MinSize 3in 5in
415  MaxSize 13in 19in
416
417
418  //
419  // These imaginary printers support printing at 600 and 1200 DPI.
420  // We'll use the new Option and Choice keywords to define the
421  // Resolution options...
422  //
423  // Option option-name option-text option-type
424  // Choice choice-name choice-text code
425  //
426  // "Option-type" is the type of option: boolean, pickone, or pickmany.
427  //
428
429  Option Resolution PickOne AnySetup 10
430  Choice "600dpi/600 DPI" "<</HWResolution[600 600]/cupsBitsPerColor 8>>setpagedevice"
431  Choice "1200dpi/1200 DPI" "<</HWResolution[1200 1200]/cupsBitsPerColor 8>>setpagedevice"
432
433
434  //
435  // One printer is grayscale only, and the other does grayscale
436  // and color.  Define the grayscale color model for both printers
437  // using the new Option and Choice keywords.
438  //
439
440  Option "ColorModel/Color Mode" PickOne AnySetup 10
441  Choice Gray/Grayscale "<</cupsColorSpace $CUPS_CSPACE_W>>setpagedevice"
442
443
444  //
445  // Both printers provide two paper trays, which we'll define using
446  // the new Option and Choice keywords...
447  //
448
449  Option "InputSlot/Input Slot" PickOne AnySetup 10
450  Choice "Upper/Main Paper Tray" "<</MediaPosition 0>>setpagedevice"
451  Choice "LargeCapacity/Large Paper Tray" "<</MediaPosition 1>>setpagedevice"
452
453
454  //
455  // Both printers support duplexing...
456  //
457  // The Duplex keyword accepts values of "none" (no duplexing capability),
458  // "normal" (standard duplexing capability), and "flip" (auto-duplex that
459  // requires the back side to be flipped by the RIP...)
460  //
461
462  Duplex normal
463
464
465  {
466    //
467    // The first sub-group contains the grayscale printer, which
468    // only needs the model name, PC filename, and model number
469    // values set...
470    //
471    // The ModelName keyword defines the string that is shown to
472    // the user.
473    //
474
475    ModelName "Mono Laser Printer"
476
477
478    //
479    // The ModelNumber keyword defines the cupsModelNumber
480    // attribute value.  We use the "(name name)" notation
481    // to perform a bitwise OR of the #define'd constants.
482    //
483
484    ModelNumber ($MODEL_BW $MODEL_LASER)
485
486
487    //
488    // The PCFileName keyword defines the filename of the PPD
489    // file and should be 8 characters or less + the .ppd
490    // extension.
491    //
492
493    PCFileName "fooglasr.ppd"
494  }
495
496
497  {
498    //
499    // The second sub-group contains the color printer, which
500    // needs another ColorModel definition along with the model
501    // name, PC filename, and model number values.
502    //
503    // The ModelName keyword defines the string that is shown to
504    // the user.
505    //
506
507    ModelName "Color Laser Printer"
508
509
510    //
511    // The ModelNumber keyword defines the cupsModelNumber
512    // attribute value.  We use the "(name name)" notation
513    // to perform a bitwise OR of the #define'd constants.
514    //
515
516    ModelNumber ($MODEL_COLOR $MODEL_LASER)
517
518
519    //
520    // The PCFileName keyword defines the filename of the PPD
521    // file and should be 8 characters or less + the .ppd
522    // extension.
523    //
524
525    PCFileName "fooclasr.ppd"
526
527
528    //
529    // This printer does color printing, too, so add it and make
530    // RGB the default...
531    //
532
533    ColorDevice Yes
534
535    Option "ColorModel/Color Mode" PickOne AnySetup 10
536    *Choice RGB/Color "<</cupsColorSpace $CUPS_CSPACE_RGB>>setpagedevice"
537  }
538}
539