]> git.ipfire.org Git - thirdparty/cups.git/blob - test/testfile.ps
Load cups into easysw/current.
[thirdparty/cups.git] / test / testfile.ps
1 %!PS-Adobe-3.0
2 %%BoundingBox: 0 0 612 792
3 %%Pages: 1
4 %%LanguageLevel: 1
5 %%DocumentData: Clean7Bit
6 %%DocumentSuppliedResources: procset testprint/1.3
7 %%DocumentNeededResources: font Helvetica Helvetica-Bold Times-Roman
8 %%Creator: Michael Sweet, Apple Inc.
9 %%CreationDate: D:20070606214000+0500
10 %%Title: Test Page
11 %%EndComments
12 %%BeginProlog
13 %%BeginResource procset testprint 1.3 0
14 %
15 % PostScript test page for the Common UNIX Printing System ("CUPS").
16 %
17 % Copyright 2007 Apple Inc.
18 % Copyright 1993-2007 Easy Software Products
19 %
20 % These coded instructions, statements, and computer programs are the
21 % property of Apple Inc. and are protected by Federal copyright law.
22 % Distribution and use rights are outlined in the file "LICENSE.txt"
23 % which is included with the CUPS source distribution.
24 %
25 /SEXTANT { % Draw a color wheel sextant...
26 % (name) white radius r g b SEXTANT -
27 % Loop through 100 shades...
28 0 0.010101 0.98 {
29 % Set the color...
30 dup 0.75 le { % Get "white" value
31 % Start from black
32 dup 0.75 div % val2 = val / 0.75
33
34 0 index 5 index mul % R = R * val2
35 1 index 5 index mul % G = G * val2
36 2 index 5 index mul % B = B * val2
37
38 4 -1 roll pop % Discard val2
39 } {
40 % Fade to white
41 dup neg 1 add 4 mul % val2 = (1 - val) * 4
42
43 0 index 5 index mul % R = R * val2
44 1 index neg 1 add add % + (1 - val2)
45 1 index 5 index mul % G = G * val2
46 2 index neg 1 add add % + (1 - val2)
47 2 index 5 index mul % B = B * val2
48 3 index neg 1 add add % + (1 - val2)
49
50 4 -1 roll pop % Discard val2
51 } ifelse
52 setrgbcolor % Set the color...
53
54 % Draw the polygon...
55 newpath % Start a new path...
56 dup 5 index mul % r1 = radius * val
57 0 0 3 -1 roll 0 60 arc % Draw the inner arc
58
59 dup 0.010101 add 5 index mul% r2 = (radius + 0.010101) * val
60 0 0 3 -1 roll 60 0 arcn % Draw the outer arc
61
62 closepath % Close the path
63 fill % Fill it...
64
65 pop % Pop value...
66 } for
67
68 % Draw a line around the polygons...
69 pop pop pop dup % Pop R, G, B, start
70 0 setgray % Black
71 newpath
72 0 0 moveto % Center
73 0 0 3 -1 roll 0 60 arc % Arc around octant
74 closepath % Back to center
75 stroke % Stroke it...
76
77 % Draw the label...
78 dup % Save radius
79 dup 30 cos mul % X = radius * cos(30)
80 exch 30 sin mul % Y = radius * sin(30)
81 moveto % Position label
82
83 gsave
84 30 rotate % Rotate label
85 dup 0.05 mul % Offset to the right
86 exch -0.05 mul % and down...
87 rmoveto % Offset label
88 show % Show label
89 grestore
90 } bind def
91 /CENTER { % Draw centered text
92 % (name) CENTER -
93 dup stringwidth pop % Get the width of the string
94 0.5 mul neg 0 rmoveto % Shift left 1/2 of the distance
95 show % Show the string
96 } bind def
97 /RIGHT { % Draw right-justified text
98 % (name) RIGHT -
99 dup stringwidth pop % Get the width of the string
100 neg 0 rmoveto % Shift left the entire distance
101 show % Show the string
102 } bind def
103 /NUMBER { % Draw a number
104 % power n NUMBER -
105 1 index 1 eq { % power == 1?
106 round cvi exch pop % Convert "n" to integer
107 } {
108 1 index mul round exch div % Truncate extra decimal places
109 } ifelse
110 100 string cvs show % Convert to a string and show it...
111 } bind def
112 /CUPSLOGO { % Draw the CUPS logo
113 % height CUPSLOGO
114 % Start with a big C...
115 /Helvetica findfont 1 index scalefont setfont
116 0 setgray
117 0 0 moveto
118 (C) show
119
120 % Then "UNIX Printing System" much smaller...
121 /Helvetica-Bold findfont 1 index 9 div scalefont setfont
122 0.25 mul
123 dup dup 2.0 mul moveto
124 (UNIX) show
125 dup dup 1.6 mul moveto
126 (Printing) show
127 dup 1.2 mul moveto
128 (System) show
129 } bind def
130 %%EndResource
131 %%EndProlog
132 %%Page: 1 1
133 gsave
134
135 % Determine the imageable area and device resolution...
136 initclip newpath clippath pathbbox % Get bounding rectangle
137 72 div /pageTop exch def % Get top margin in inches
138 72 div /pageRight exch def % Get right margin in inches
139 72 div /pageBottom exch def % Get bottom margin in inches
140 72 div /pageLeft exch def % Get left margin in inches
141
142 4 setlinewidth % Draw wide lines
143 0 setgray closepath stroke % Draw a clipping rectangle
144
145 /pageWidth pageRight pageLeft sub def % pageWidth = pageRight - pageLeft
146 /pageHeight pageTop pageBottom sub def% pageHeight = pageTop - pageBottom
147
148 72 72 dtransform % Get device resolution per inch
149 /yResolution exch abs def % yResolution = abs(yres)
150 /xResolution exch abs def % xResolution = abs(xres)
151
152 % Figure out the sizes of things...
153 /wheelSize % size of wheels
154 pageWidth pageHeight lt
155 { pageWidth 9 mul }
156 { pageHeight 7 mul }
157 ifelse def
158
159 % Create fonts...
160 /bigFont /Helvetica-Bold findfont % bigFont = Helvetica-Bold
161 pageHeight 3 mul scalefont def % size = pageHeight * 3 (nominally 33)
162
163 /mediumFont /Helvetica findfont % mediumFont = Helvetica
164 pageHeight 1.5 mul scalefont def % size = pageHeight * 1.5 (nominally 16.5)
165
166 /smallFont /Times-Roman findfont % smallFont = Times-Roman
167 pageHeight scalefont def % size = pageHeight (nominally 11)
168
169 % Draw rulers along the edges...
170 /CENTIMETER 72 2.54 div def
171 /MILLIMETER 72 25.4 div def
172
173 /Times-Roman findfont % Font for ruler numbers
174 11 scalefont setfont % 11 points
175
176 gsave % Left side inches
177 pageLeft 72 mul 0 translate % Offset left edge
178
179 1 setlinewidth % Draw normal lines
180 72 72 pageTop 72 mul { % Height inches
181 dup dup
182 0 exch moveto 24 0 rlineto stroke % Draw tic mark
183 24 exch pageHeight sub moveto % Draw number
184 72 div cvi 10 string cvs RIGHT
185 } for
186
187 0.5 setlinewidth % Draw thin lines
188 18 18 pageTop 72 mul { % 1/4 inches
189 0 exch moveto 15 0 rlineto stroke % Draw tic mark
190 } for
191
192 9 9 pageTop 72 mul { % 1/8 inches
193 0 exch moveto 6 0 rlineto stroke % Draw tic mark
194 } for
195 grestore
196
197 gsave % Bottom inches
198 0 pageBottom 72 mul translate % Offset bottom edge
199
200 1 setlinewidth % Draw normal lines
201 72 72 pageRight 72 mul { % Width inches
202 dup dup
203 0 moveto 0 24 rlineto stroke % Draw tic mark
204 3 add 27 pageHeight sub moveto % Draw number
205 72 div cvi 10 string cvs show
206 } for
207
208 0.5 setlinewidth % Draw thin lines
209 18 18 pageRight 72 mul { % 1/4 inches
210 0 moveto 0 15 rlineto stroke % Draw tic mark
211 } for
212
213 9 9 pageRight 72 mul { % 1/8 inches
214 0 moveto 0 6 rlineto stroke % Draw tic mark
215 } for
216 grestore
217
218 gsave % Right side centimeters
219 pageRight 72 mul 0 translate % Offset right edge
220
221 1 setlinewidth % Draw normal lines
222 CENTIMETER CENTIMETER
223 pageTop 72 mul { % Height centimeters
224 0 exch moveto -24 0 rlineto stroke% Draw tic mark
225 } for
226 1 1 pageTop 2.54 mul { % Height labels
227 dup
228 -24 exch CENTIMETER mul
229 pageHeight sub moveto % Draw number
230 cvi 10 string cvs show
231 } for
232
233 0.5 setlinewidth % Draw thin lines
234 0 0.5 CENTIMETER mul
235 pageTop 72 mul { % 1/2 centimeters
236 0 exch moveto -15 0 rlineto stroke% Draw tic mark
237 } for
238 0 MILLIMETER pageTop 72 mul { % Millimeters
239 0 exch moveto -6 0 rlineto stroke % Draw tic mark
240 } for
241 grestore
242
243 gsave % Top centimeters
244 0 pageTop 72 mul translate % Offset top edge
245
246 1 setlinewidth % Draw normal lines
247 CENTIMETER CENTIMETER
248 pageRight 72 mul { % Width centimeters
249 0 moveto 0 -24 rlineto stroke % Draw tic mark
250 } for
251 1 1 pageRight 2.54 mul { % Width labels
252 dup
253 CENTIMETER mul 3 add -24 moveto % Draw number
254 cvi 10 string cvs show
255 } for
256
257 0.5 setlinewidth % Draw thin lines
258 0 0.5 CENTIMETER mul
259 pageRight 72 mul { % 1/2 centimeters
260 0 moveto 0 -15 rlineto stroke % Draw tic mark
261 } for
262 0 MILLIMETER pageRight 72 mul { % Millimeters
263 0 moveto 0 -6 rlineto stroke % Draw tic mark
264 } for
265 grestore
266
267 % Offset page to account for lower-left margin...
268 pageLeft 72 mul
269 pageBottom 72 mul
270 translate
271
272 % Set text font and color...
273 mediumFont setfont % Font
274 0 setgray % Color
275 1 setlinewidth % Draw normal lines
276
277 % Draw the color wheel...
278 gsave
279 % Position the wheel on the left side...
280 pageWidth 18 mul % x = pageWidth * 1/4 * 72
281 pageHeight 54 mul % y = pageHeight * 3/4 * 72
282 translate
283
284 % Size the wheel...
285 wheelSize
286
287 % Draw the colors...
288 dup (C) 3 -1 roll 0 1 1 SEXTANT 60 rotate
289 dup (M) 3 -1 roll 1 0 1 SEXTANT 60 rotate
290 dup (Y) 3 -1 roll 1 1 0 SEXTANT 60 rotate
291 dup (R) 3 -1 roll 1 0 0 SEXTANT 60 rotate
292 dup (G) 3 -1 roll 0 1 0 SEXTANT 60 rotate
293 dup (B) 3 -1 roll 0 0 1 SEXTANT 60 rotate
294
295 pop
296 grestore
297
298 % Label the color wheel...
299 pageWidth 18 mul % x = pageWidth * 1/4 * 72
300 pageHeight 43 mul % y = pageHeight * 19/32 * 72
301 moveto % Position the text
302 (Color Wheel) CENTER % Show the text centered
303
304 % Draw the gray ramp...
305 gsave
306 % Position the gray ramp in the center...
307 pageWidth 36 mul % x = pageWidth * 1/2 * 72
308 pageHeight 54 mul % y = pageHeight * 3/4 * 72
309 wheelSize sub % - wheelSize
310 translate
311
312 % Loop through 100 shades...
313 0 0.010101 0.98 {
314 % Set the color...
315 dup setgray % Set the grayscale...
316
317 % Draw the polygon...
318 newpath % Start a new path...
319
320 wheelSize -0.2 mul % X = -wheelSize / 5
321 1 index 2 mul wheelSize mul % Y = val * 2 * wheelSize
322 moveto % Move there...
323
324 wheelSize 0.4 mul 0 rlineto % Right side...
325
326 wheelSize 0.2 mul % X = wheelSize / 5
327 1 index 0.010101 add 2 mul wheelSize mul
328 % Y = (val + 0.010101) * 2 * wheelSize
329 lineto % Move there...
330
331 wheelSize -0.4 mul 0 rlineto % Left side...
332
333 closepath % Close the path
334 fill % Fill it...
335
336 pop % Pop value...
337 } for
338
339 0 setgray % Black
340
341 newpath % Start a new path
342 wheelSize -0.2 mul 0 moveto % Bottom left
343 wheelSize 0.4 mul 0 rlineto % Bottom right
344 0 wheelSize 2 mul rlineto % Upper right
345 wheelSize -0.4 mul 0 rlineto % Upper left
346 closepath % Close the path
347 stroke % Stroke it...
348
349 0 wheelSize -0.2 mul moveto % Center bottom for label
350 (K) CENTER % Center K at bottom
351
352 0 wheelSize 2.05 mul moveto % Center top for label
353 (W) CENTER % Center W at top
354 grestore
355
356 % Label the gray ramp...
357 pageWidth 36 mul % x = pageWidth * 1/2 * 72
358 pageHeight 43 mul % y = pageHeight * 19/32 * 72
359 moveto % Position the text
360 (Gray Ramp) CENTER % Show the text centered
361
362
363 % Draw radial lines...
364 gsave
365 0 setlinewidth % 1 pixel lines
366
367 % Position the lines on the left side...
368 pageWidth 54 mul % x = pageWidth * 3/4 * 72
369 pageHeight 54 mul % y = pageHeight * 3/4 * 72
370 translate
371
372 % Size the wheel...
373 wheelSize
374
375 % Loop at 1 degree increments
376 0 1 359 {
377 pop % Discard angle - not used
378 0 0 moveto % Start line at the center
379 dup 0 lineto % Draw to the radius
380 1 rotate % Rotate 1 degree
381 } for
382
383 pop % Discard radius - not needed anymore
384 stroke % Draw lines...
385
386 grestore
387
388 % Label the lines...
389 pageWidth 54 mul % x = pageWidth * 3/4 * 72
390 pageHeight 43 mul % y = pageHeight * 19/32 * 72
391 moveto % Position the text
392 (1 Degree Radial Lines) CENTER % Show the text centered
393
394 % Imageable area...
395 pageHeight 15 mul % Height of imageable area
396
397 pageWidth 4.5 mul % x = pageWidth * 1/16 * 72
398 pageHeight 35.5 mul % y = pageHeight * 1/2 * 72
399 2 index sub % y -= height
400 pageWidth 28 mul % width = pageWidth * 1/4 * 72
401 3 index % height
402 0.5 setgray rectfill % Draw a shadow
403
404 pageWidth 4 mul % x = pageWidth * 1/16 * 72
405 pageHeight 36 mul % y = pageHeight * 1/2 * 72
406 2 index sub % y -= height
407 pageWidth 28 mul % width = pageWidth * 3/8 * 72
408 3 index % height
409 4 copy 1 setgray rectfill % Clear the box to white
410 0 setgray rectstroke % Draw a black box around it...
411
412 pop % Discard height
413
414 % Label the imageable area...
415 pageWidth 4 mul % x = pageWidth * 1/16 * 72
416 pageHeight 37 mul % y = pageHeight * 1/2 * 72
417 moveto % Position the text
418 mediumFont setfont % Font
419 (Imageable Area) show % Show the text
420
421 smallFont setfont % Font
422 pageWidth 14 mul % x = pageWidth * 3/16 * 72
423 pageHeight 36 mul % y = pageWidth * 1/2 * 72
424 pageHeight -2 mul add % y -= 2 * smallFont height
425
426 % Page Size inches
427 2 copy moveto % Move to x & y
428 (Page Size: ) RIGHT % Label
429 100 pageWidth NUMBER % pageWidth
430 (x) show % "x"
431 100 pageHeight NUMBER % pageHeight
432 (in) show % "in"
433
434 % Page Size millimeters
435 pageHeight sub % Move down...
436
437 2 copy moveto % Move to x & y
438 10 pageWidth 25.4 mul NUMBER % pageWidth
439 (x) show % "x"
440 10 pageHeight 25.4 mul NUMBER % pageHeight
441 (mm) show % "mm"
442
443 % Lower-left inches
444 pageHeight 2 mul sub % Move down...
445
446 2 copy moveto % Move to x & y
447 (Lower-Left: ) RIGHT % Label
448 100 pageLeft NUMBER % pageLeft
449 (x) show % "x"
450 100 pageBottom NUMBER % pageBottom
451 (in) show % "in"
452
453 % Lower-left millimeters
454 pageHeight sub % Move down...
455
456 2 copy moveto % Move to x & y
457 10 pageLeft 25.4 mul NUMBER % pageLeft
458 (x) show % "x"
459 10 pageBottom 25.4 mul NUMBER % pageBottom
460 (mm) show % "mm"
461
462 % Upper-right inches
463 pageHeight 2 mul sub % Move down...
464
465 2 copy moveto % Move to x & y
466 (Upper-Right: ) RIGHT % Label
467 100 pageRight NUMBER % pageRight
468 (x) show % "x"
469 100 pageTop NUMBER % pageTop
470 (in) show % "in"
471
472 % Upper-right millimeters
473 pageHeight sub % Move down...
474
475 2 copy moveto % Move to x & y
476 10 pageRight 25.4 mul NUMBER % pageRight
477 (x) show % "x"
478 10 pageTop 25.4 mul NUMBER % pageTop
479 (mm) show % "mm"
480
481 % Resolution dots-per-inch
482 pageHeight 2 mul sub % Move down...
483
484 2 copy moveto % Move to x & y
485 (Resolution: ) RIGHT % Label
486 1 xResolution NUMBER % xResolution
487 (x) show % "x"
488 1 yResolution NUMBER % yResolution
489 (dpi) show % "dpi"
490
491 % Resolution dots-per-meter
492 pageHeight sub % Move down...
493
494 moveto % Move to x & y
495 1 xResolution 39.27 mul NUMBER % xResolution
496 (x) show % "x"
497 1 yResolution 39.27 mul NUMBER % yResolution
498 (dpm) show % "dpm"
499
500 % Interpreter Information...
501 pageHeight 15 mul % Height of interpreter information
502
503 pageWidth 40.5 mul % x = pageWidth * 9/16 * 72
504 pageHeight 35.5 mul % y = pageHeight * 1/2 * 72
505 2 index sub % y -= height
506 pageWidth 28 mul % width = pageWidth * 1/4 * 72
507 3 index % height
508 0.5 setgray rectfill % Draw a shadow
509
510 pageWidth 40 mul % x = pageWidth * 9/16 * 72
511 pageHeight 36 mul % y = pageHeight * 1/2 * 72
512 2 index sub % y -= height
513 pageWidth 28 mul % width = pageWidth * 3/8 * 72
514 3 index % height
515 4 copy 1 setgray rectfill % Clear the box to white
516 0 setgray rectstroke % Draw a black box around it...
517
518 pop % Discard height
519
520 % Label the interpreter info...
521 pageWidth 40 mul % x = pageWidth * 9/16 * 72
522 pageHeight 37 mul % y = pageHeight * 1/2 * 72
523 moveto % Position the text
524 mediumFont setfont % Font
525 (Interpreter Information) show % Show the text
526
527 smallFont setfont % Font
528 pageWidth 49 mul % x = pageWidth * 11/16 * 72
529 pageHeight 36 mul % y = pageWidth * 1/2 * 72
530 pageHeight 2 mul sub % y -= 2 * smallFont height
531
532 % Language level
533 2 copy moveto % Move to x & y
534 (PostScript: ) RIGHT % Label
535 (Level ) show % "Level "
536 1 languagelevel NUMBER % Language level
537
538 % Version
539 pageHeight 2 mul sub % Move down...
540 2 copy moveto % Move to x & y
541 (Version: ) RIGHT % Label
542 version show % Version
543 ( \() show % " ("
544 1 revision NUMBER % Revision
545 (\)) show % ")"
546
547 % Product
548 pageHeight 2 mul sub % Move down...
549 2 copy moveto % Move to x & y
550 (Product: ) RIGHT % Label
551 product show % Product name
552
553 % Serial Number
554 pageHeight 2 mul sub % Move down...
555 moveto % Move to x & y
556 (Serial #: ) RIGHT % Label
557 1 serialnumber NUMBER % S/N
558
559 % Draw the label at the top...
560 pageWidth 36 mul % Center of page
561 pageHeight 66 mul % Top of page (11/12ths)
562 moveto % Position text
563 bigFont setfont % Font
564 (Printer Test Page) CENTER % Show text centered
565
566 % Draw the copyright notice at the bottom...
567 pageWidth 17 mul % Center of page
568 pageHeight 10 mul % Bottom of page
569 moveto % Position text
570 (Printed Using CUPS v1.3.x) show
571
572 pageWidth 17 mul % Left side of page
573 pageHeight 8 mul % Move down...
574 2 copy moveto % Position text
575 smallFont setfont % Font
576 (Copyright 2007 Apple Inc., All Rights Reserved. CUPS and the CUPS logo are the trademark) show
577 pageHeight 2 add sub % Move down...
578 2 copy moveto % Position text
579 (property of Apple Inc., 1 Infinite Loop, Cupertino, CA 95014, USA.) show
580 pageHeight 2 mul 4 add sub % Move down...
581 moveto % Position text
582 (Need help? Contact your operating system vendor or visit "http://www.cups.org/".) show
583
584 % Then the CUPS logo....
585 gsave
586 pageWidth 4 mul
587 pageHeight 4 mul
588 translate
589 pageWidth 15 mul CUPSLOGO
590 grestore
591
592 % Show the page...
593 grestore
594 showpage
595 %
596 % End of "$Id: testfile.ps 6649 2007-07-11 21:46:42Z mike $".
597 %
598 %%EOF