Files: d362cada9d1fece1ac933832b994a43578709c74 / example_check.ps
24287 bytesRaw
1 | %!PS-Adobe-3.0 |
2 | %%Title: FreeCheck |
3 | %%LanguageLevel: 2 |
4 | %%EndComments |
5 | %%BeginProlog |
6 | /inch {72 mul} def |
7 | /PrintCheckBody {true} def |
8 | /LogoHeight {0.6 inch} def |
9 | /MemoLineHeight {0.25} def |
10 | /PayeeLineHeight {0.60} def |
11 | /Routing (R123456780R) def |
12 | /SignatureLineHeight {0.25} def |
13 | /CheckHeight {2.83 inch} def |
14 | /OnUs (S4232268154PSCCCC) def |
15 | /TransitSymbol (A) def |
16 | /LeftMargin {0.20 inch} def |
17 | /NumPages {1} def |
18 | /MICRFontSize {12} def |
19 | /MICRHorTweak {0} def |
20 | /Fraction (37-5678/1234) def |
21 | /OnUsSymbol (C) def |
22 | /DashSymbol (D) def |
23 | /CheckNumFontName /Helvetica-Bold def |
24 | /BankCityStateZip (Anytown, USA 12345) def |
25 | /StandardFontSize {9} def |
26 | /DateLineHeight {0.75} def |
27 | /Name1 (JOHN SMITH) def |
28 | /Name2 (MARY SMITH) def |
29 | /CheckVerOffset {2.50 inch} def |
30 | /CheckNumDigits {4} def |
31 | /CheckLayout /Original def |
32 | /LineWidth {0.3} def |
33 | /AmountSymbol (B) def |
34 | /LogoBorder {0.0312 inch} def |
35 | /TopMargin {0.20 inch} def |
36 | /CityStateZip (Anytown, USA 12345) def |
37 | /PrintVOID {false} def |
38 | /LogoPadding {0.0625 inch} def |
39 | /BankInfoHeight {0.45} def |
40 | /MICRFontName /GnuMICR def |
41 | /CheckHorOffset {2.50 inch} def |
42 | /BankAddr1 (6780 Main Street) def |
43 | /AmountLineHeight {0.50} def |
44 | /BankAddr2 (Suite 45) def |
45 | /PhoneNumber (512-555-1212) def |
46 | /PrintMICRLine {true} def |
47 | /StandardFontName /AvantGarde-Book def |
48 | /Address1 (1234 Main Street) def |
49 | /Address2 () def |
50 | /BankName (MegaCorp Bank, NA) def |
51 | /AuxOnUs () def |
52 | /CheckWidth {6.00 inch} def |
53 | /CheckNumber {196} def |
54 | /ChecksPerPage {3} def |
55 | /MICRVerTweak {0} def |
56 | /RightMargin {0.25 inch} def |
57 | /CheckNumFontSize {14} def |
58 | /LogoWidth {0.7 inch} def |
59 | |
60 | % This is the main body of the postscript file, that acts on all of the |
61 | % definitions we got from the config file. |
62 | |
63 | % Available Check Layouts |
64 | /CheckLayoutDict << |
65 | /Original { DrawOriginalCheckBody } |
66 | /QStandard { DrawQStandardCheckBody } |
67 | /QWallet { DrawQWalletCheckBody } |
68 | >> def |
69 | |
70 | % Other Constants: |
71 | |
72 | % Size of the rectangular box for the amount (digits) |
73 | /AmountBoxWidth {1 inch} def |
74 | /AmountBoxHeight {0.25 inch} def |
75 | |
76 | % Max number of digits in check number, and allocate string |
77 | /CheckNumDigits 4 def |
78 | /CheckNumberString CheckNumber log floor 1 add cvi string def |
79 | |
80 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
81 | % Helpful Printing Routines % |
82 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
83 | |
84 | % Shows a line, then does a "carriage return / line feed" |
85 | % But only if the string exists (more than 0 chars) |
86 | % (How do we get the current font size (height)?) |
87 | |
88 | /ShowAndCR { |
89 | % if |
90 | dup length 0 gt % First copy |
91 | { |
92 | dup show % Second copy |
93 | stringwidth pop neg 0 rmoveto % Original copy & move back |
94 | neg 0 exch rmoveto % line down |
95 | } |
96 | % else |
97 | { |
98 | pop % discard (string) |
99 | pop % discard height |
100 | } |
101 | ifelse |
102 | } def |
103 | |
104 | %%BeginProcSet: substitute |
105 | %%Creator: James Klicman <james@klicman.org> |
106 | %%CreationDate: October 2002 |
107 | %%Version: 0.3 |
108 | % |
109 | % (string) (O) (N) substitute - |
110 | % |
111 | % example: (A?C) (?) (B) substitute -> (ABC) |
112 | % |
113 | /substitute { |
114 | 0 get exch 0 get exch % convert (O) and (N) to char codes |
115 | 0 % counter |
116 | 3 index % (string) {} forall |
117 | { |
118 | % ^ (string) O N counter C |
119 | 3 index % (O)[0] |
120 | eq % (string)[i] == (O)[0] |
121 | { |
122 | % ^ (string) O N counter |
123 | 3 index % (string) |
124 | % ^ (string) O N counter (string) |
125 | 1 index % counter |
126 | % ^ (string) O N counter (string) counter |
127 | 3 index % N |
128 | % ^ (string) O N counter (string) counter N |
129 | put % (string) counter N put |
130 | } if |
131 | 1 add % increment counter |
132 | } forall |
133 | pop % counter |
134 | pop % N |
135 | pop % O |
136 | pop % (string) |
137 | } def |
138 | %%EndProcSet |
139 | |
140 | % Fix up the MICR line components (replace placeholders with MICR |
141 | % characters) |
142 | % Argh... surely there's a better way - anyone? use "forall?" |
143 | |
144 | /FixMICR { |
145 | |
146 | /CheckNumStart -1 def |
147 | /CheckNumEnd -1 def |
148 | /CheckNumInOnUs false def |
149 | /CheckNumInAuxOnUs false def |
150 | |
151 | % Get starting and ending positions for check number in |
152 | % (Aux)OnUs field |
153 | % (This will break if check number is entered in both fields) |
154 | |
155 | OnUs length 1 sub -1 0 { |
156 | dup % dups the index |
157 | OnUs exch get (C) 0 get eq { |
158 | /CheckNumInOnUs true def |
159 | % If end number not yet defined, define it |
160 | CheckNumEnd 0 lt { |
161 | /CheckNumEnd exch def |
162 | } { |
163 | /CheckNumStart exch def |
164 | } ifelse |
165 | |
166 | } { |
167 | pop |
168 | } ifelse |
169 | } for |
170 | |
171 | AuxOnUs length 1 sub -1 0 { |
172 | dup % dups the index |
173 | AuxOnUs exch get (C) 0 get eq { |
174 | /CheckNumInAuxOnUs true def |
175 | % If end number not yet defined, define it |
176 | CheckNumEnd 0 lt { |
177 | /CheckNumEnd exch def |
178 | } { |
179 | /CheckNumStart exch def |
180 | } ifelse |
181 | |
182 | } { |
183 | pop |
184 | } ifelse |
185 | } for |
186 | |
187 | |
188 | % Replace "R" in routing number with actual transit number symbol |
189 | % That's it - should be no spaces, dashes, or anything but digits |
190 | Routing (R) TransitSymbol substitute |
191 | |
192 | % Replace "S" with space character in AuxOnUs |
193 | AuxOnUs (S) ( ) substitute |
194 | |
195 | % Replace "-" with dash character in AuxOnUs |
196 | AuxOnUs (-) DashSymbol substitute |
197 | |
198 | % Replace "P" with OnUs character in AuxOnUs |
199 | AuxOnUs (P) OnUsSymbol substitute |
200 | |
201 | % Replace "S" with space character in OnUs |
202 | OnUs (S) ( ) substitute |
203 | |
204 | % Replace "-" with dash character in OnUs |
205 | OnUs (-) DashSymbol substitute |
206 | |
207 | % Replace "P" with OnUs character in OnUs |
208 | OnUs (P) OnUsSymbol substitute |
209 | |
210 | } def |
211 | |
212 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
213 | % Original Feature Printing Routines % |
214 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
215 | |
216 | /DrawMemoLine { |
217 | LeftMargin MemoLineHeight CheckHeight mul moveto |
218 | 2.5 inch 0 inch rlineto |
219 | -2.5 inch 0 inch rmoveto |
220 | 0 2 rmoveto |
221 | (for) show |
222 | } def |
223 | |
224 | /DrawSignatureLine { % Expects height of signature line |
225 | % and right edge of check for |
226 | % beginning position |
227 | |
228 | CheckWidth SignatureLineHeight CheckHeight mul moveto |
229 | RightMargin neg 0 rmoveto |
230 | -2.5 inch 0 rmoveto |
231 | 2.5 inch 0 inch rlineto |
232 | |
233 | } def |
234 | |
235 | /DrawAmountLine { |
236 | CheckWidth AmountLineHeight CheckHeight mul moveto |
237 | RightMargin neg 0 rmoveto |
238 | (DOLLARS) stringwidth pop neg 0 rmoveto |
239 | (DOLLARS) show |
240 | (DOLLARS) stringwidth pop neg 0 rmoveto |
241 | -2 0 rmoveto |
242 | LeftMargin AmountLineHeight CheckHeight mul lineto |
243 | } def |
244 | |
245 | /DrawAccountHolderInfo { |
246 | LeftMargin CheckHeight moveto |
247 | 0 TopMargin neg rmoveto |
248 | 0 StandardFontSize neg rmoveto |
249 | |
250 | % make room for Logo if specified |
251 | /LogoForm where { |
252 | pop % discard dict |
253 | LogoWidth |
254 | /LogoBorder where { |
255 | pop % discard dict |
256 | LogoBorder 2 div add |
257 | } if |
258 | /LogoPadding where { |
259 | pop % discard dict |
260 | LogoPadding 2 div add |
261 | } if |
262 | 0 rmoveto |
263 | } if |
264 | |
265 | StandardFontSize Name1 ShowAndCR |
266 | StandardFontSize Name2 ShowAndCR |
267 | |
268 | StandardFontName findfont |
269 | StandardFontSize 1 sub scalefont |
270 | setfont |
271 | |
272 | StandardFontSize 1 sub Address1 ShowAndCR |
273 | StandardFontSize 1 sub Address2 ShowAndCR |
274 | StandardFontSize 1 sub CityStateZip ShowAndCR |
275 | StandardFontSize 1 sub PhoneNumber ShowAndCR |
276 | |
277 | StandardFontName findfont |
278 | StandardFontSize 1 add scalefont |
279 | setfont |
280 | } def |
281 | |
282 | /DrawDateLine { |
283 | 0.6 CheckWidth mul DateLineHeight CheckHeight mul moveto |
284 | (Date) show |
285 | 1 inch 0 rlineto |
286 | } def |
287 | |
288 | /DrawBankInfo { |
289 | LeftMargin BankInfoHeight CheckHeight mul moveto |
290 | |
291 | StandardFontSize BankName ShowAndCR |
292 | |
293 | StandardFontName findfont |
294 | StandardFontSize 1 sub scalefont |
295 | setfont |
296 | |
297 | StandardFontSize 1 sub BankAddr1 ShowAndCR |
298 | StandardFontSize 1 sub BankAddr2 ShowAndCR |
299 | StandardFontSize 1 sub BankCityStateZip ShowAndCR |
300 | |
301 | StandardFontName findfont |
302 | StandardFontSize 1 add scalefont |
303 | setfont |
304 | } def |
305 | |
306 | /DrawPayeeLine { |
307 | |
308 | LeftMargin PayeeLineHeight CheckHeight mul moveto |
309 | (ORDER OF) show |
310 | (ORDER OF) stringwidth pop neg StandardFontSize rmoveto |
311 | (PAY TO THE) show |
312 | 0 StandardFontSize neg rmoveto |
313 | 4 0 rmoveto |
314 | currentpoint mark |
315 | |
316 | CheckWidth PayeeLineHeight CheckHeight mul moveto |
317 | RightMargin neg 0 rmoveto |
318 | AmountBoxWidth neg 0 rmoveto |
319 | |
320 | 0 AmountBoxHeight rlineto |
321 | AmountBoxWidth 0 rlineto |
322 | 0 AmountBoxHeight neg rlineto |
323 | AmountBoxWidth neg 0 rlineto |
324 | |
325 | -4 0 rmoveto |
326 | |
327 | /Helvetica-Bold findfont |
328 | 14 scalefont |
329 | setfont |
330 | |
331 | ($) stringwidth pop neg 0 rmoveto |
332 | ($) show |
333 | ($) stringwidth pop neg 0 rmoveto |
334 | |
335 | -4 0 rmoveto |
336 | cleartomark |
337 | lineto |
338 | |
339 | StandardFontName findfont |
340 | StandardFontSize scalefont |
341 | setfont |
342 | |
343 | } def |
344 | |
345 | /DrawCheckNumber { |
346 | CheckWidth CheckHeight moveto |
347 | RightMargin neg TopMargin neg rmoveto |
348 | CheckNumFontName findfont |
349 | CheckNumFontSize scalefont |
350 | setfont |
351 | |
352 | CheckNumberString stringwidth pop neg 0 rmoveto |
353 | 0 -14 rmoveto |
354 | CheckNumberString show |
355 | |
356 | StandardFontName findfont |
357 | StandardFontSize scalefont |
358 | setfont |
359 | } def |
360 | |
361 | /DrawFraction { |
362 | 0.6 CheckWidth mul CheckHeight moveto |
363 | 0 TopMargin neg rmoveto |
364 | 0 StandardFontSize neg rmoveto |
365 | Fraction show |
366 | } def |
367 | |
368 | /DrawStub { |
369 | CheckHorOffset 2 inch ge { |
370 | save |
371 | newpath |
372 | CheckHorOffset neg 0 translate |
373 | StandardFontName findfont |
374 | StandardFontSize 1 sub scalefont |
375 | setfont |
376 | /StubSpacing {CheckHeight 6 div} def |
377 | CheckHorOffset 2 div StubSpacing 5 mul moveto |
378 | CheckNumberString show |
379 | 0.3 inch StubSpacing 4 mul moveto |
380 | (Date ) show |
381 | CheckHorOffset 0.3 inch sub StubSpacing 4 mul lineto |
382 | 0.3 inch StubSpacing 3 mul moveto |
383 | (Payee ) show |
384 | CheckHorOffset 0.3 inch sub StubSpacing 3 mul lineto |
385 | 0.3 inch StubSpacing 2 mul moveto |
386 | (Amount ) show |
387 | CheckHorOffset 0.3 inch sub StubSpacing 2 mul lineto |
388 | 0.3 inch StubSpacing 1 mul moveto |
389 | (Memo ) show |
390 | CheckHorOffset 0.3 inch sub StubSpacing 1 mul lineto |
391 | stroke |
392 | restore |
393 | } if |
394 | } def |
395 | |
396 | /DrawOriginalCheckBody { |
397 | DrawBankInfo |
398 | DrawAccountHolderInfo |
399 | DrawMemoLine |
400 | DrawSignatureLine |
401 | DrawAmountLine |
402 | DrawPayeeLine |
403 | DrawCheckNumber |
404 | DrawFraction |
405 | DrawDateLine |
406 | /DrawLogo where { pop DrawLogo } if |
407 | DrawStub |
408 | } def |
409 | |
410 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
411 | % QStandard & QWallet Feature Printing Routines % |
412 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
413 | |
414 | %%BeginProcSet: nextline |
415 | %%Creator: James Klicman <james@klicman.org> |
416 | %%CreationDate: October 2002 |
417 | %%Version: 0.3 |
418 | |
419 | % |
420 | % state used by initline and nextline |
421 | % |
422 | /LINESTATE << |
423 | /x 0 |
424 | /y 0 |
425 | /rx 0 |
426 | /ry 0 |
427 | >> def |
428 | |
429 | % |
430 | % LineHeight initline - |
431 | % |
432 | /initline { |
433 | LINESTATE begin |
434 | currentpoint |
435 | /y exch def |
436 | /x exch def |
437 | /ty exch def |
438 | /tx exch def |
439 | end |
440 | } def |
441 | |
442 | % |
443 | % - nextline - |
444 | % |
445 | /nextline { |
446 | LINESTATE begin |
447 | x tx add |
448 | dup /x exch def % x += tx |
449 | y ty add |
450 | dup /y exch def % y += ty |
451 | moveto % x y moveto |
452 | end |
453 | } def |
454 | %%EndProcSet |
455 | |
456 | |
457 | %%BeginProcSet: alignment |
458 | %%Creator: James Klicman <james@klicman.org> |
459 | %%CreationDate: October 2002 |
460 | %%Version: 0.3 |
461 | % |
462 | % (string) centeralign (string) |
463 | % |
464 | /centeralign { |
465 | dup % dup (string) |
466 | stringwidth % calculate string xWidth, yHeight |
467 | pop % discard yHeight |
468 | 2 div neg % -(xWidth / 2) |
469 | 0 rmoveto % rmoveto center |
470 | } def |
471 | |
472 | % |
473 | % (string) rightalign (string) |
474 | % |
475 | /rightalign { |
476 | dup stringwidth % calculate string xWidth, yHeight |
477 | pop % discard yHeight |
478 | neg 0 rmoveto % -xWidth 0 rmoveto |
479 | } def |
480 | |
481 | % |
482 | % (string) stringbbox x1 y1 x2 y2 |
483 | % |
484 | % This procedure is based on the method described in Chapter 5 page 333 |
485 | % of the PostScript Language Reference third edition. |
486 | % |
487 | /stringbbox { |
488 | gsave |
489 | newpath 0 0 moveto false charpath flattenpath pathbbox % x1 y1 x2 y2 |
490 | grestore |
491 | } def |
492 | |
493 | % |
494 | % (string) topalign (string) |
495 | % |
496 | /topalign { |
497 | dup stringbbox % ^+ x1 y1 x2 y2 |
498 | neg 0 exch rmoveto % 0 -y2 rmoveto |
499 | pop % x2 |
500 | pop % y1 |
501 | pop % x1 |
502 | } def |
503 | |
504 | % |
505 | % (string) bottomalign (string) |
506 | % |
507 | /bottomalign { |
508 | dup stringbbox % ^+ x1 y1 x2 y2 |
509 | pop % y2 |
510 | pop % x2 |
511 | neg 0 exch rmoveto % 0 -y1 rmoveto |
512 | pop % x1 |
513 | } def |
514 | %%EndProcSet |
515 | |
516 | |
517 | %%BeginProcSet: qchecks |
518 | %%Creator: James Klicman <james@klicman.org> |
519 | %%CreationDate: October 2002 |
520 | %%Version: 0.3 |
521 | |
522 | /QStandardConfig << |
523 | /RightMarginX CheckWidth RightMargin sub |
524 | /UnderlineOffset -3 |
525 | /MemoLineWidth 3.25 inch |
526 | /SignatureLineWidth 3.25 inch |
527 | /PayToTheOrderOf { |
528 | currentpoint % oldpoint |
529 | 0 StandardFontSize rmoveto % move up one line |
530 | (PAY TO THE) show |
531 | moveto % oldpoint moveto |
532 | (ORDER OF ) show |
533 | } |
534 | % QStandard Coords, Check Size 8.5" x 3.5" |
535 | /Date [ 503.08 183.44] |
536 | /Amount [ 499.96 147.44 ] |
537 | /Verbal [ 36.04 123.44 ] |
538 | /Payee [ 84.04 147.44 ] |
539 | /Memo [ 63.16 39.44 ] |
540 | /Address [ 72.04 99.44 ] |
541 | /Stub false |
542 | >> def |
543 | |
544 | /QWalletConfig << |
545 | /RightMarginX CheckWidth RightMargin sub |
546 | /UnderlineOffset -2 |
547 | /MemoLineWidth 2.5 inch |
548 | /SignatureLineWidth 2.5 inch |
549 | /PayToTheOrderOf { |
550 | 0 StandardFontSize 2 mul rmoveto % move up two lines |
551 | 0 StandardFontSize neg initline |
552 | (PAY) show nextline |
553 | (TO THE) show nextline |
554 | (ORDER OF ) show |
555 | } |
556 | % QWallet Coords, Check Size 6" x 2.8333" |
557 | /Date [ 346.12 147.44 ] |
558 | /Amount [ 331.96 135.44 ] |
559 | /Verbal [ 24.04 123.44 ] |
560 | /Payee [ 46.12 135.44 ] |
561 | /Address [ 25.0 99.44 ] |
562 | /Memo [ 45.16 39.44 ] |
563 | /Stub true |
564 | /StubDate [ 31.96 147.44 ] |
565 | /StubPayee [ 31.96 123.44 ] |
566 | /StubAmount [ 52.12 87.44 ] |
567 | /StubMemo [ 31.96 63.44 ] |
568 | /StubCategory [ 31.96 39.44 ] |
569 | /StubAccount [ 31.96 15.44 ] |
570 | >> def |
571 | |
572 | |
573 | % |
574 | % /name (label) DrawQLabeline-rightmargin - |
575 | % |
576 | % draw label and underline to right margin |
577 | % |
578 | /DrawQLabeline-rightmargin { |
579 | % show label |
580 | % ^ /name (label) |
581 | exch QCONFIG exch get aload pop % ^ (label) X Y |
582 | 2 copy % ^ (label) X Y X Y |
583 | moveto % X Y moveto |
584 | 3 -1 roll % (label) X Y -> X Y (label) |
585 | rightalign show % (label) rightalign show |
586 | |
587 | % ^ X Y |
588 | |
589 | Underline { % if |
590 | % underline |
591 | % line goes from end of label to right margin |
592 | % ^ X Y |
593 | exch ( ) stringwidth pop sub exch % backup X one space |
594 | QCONFIG /UnderlineOffset get add % adjust underline position |
595 | newpath |
596 | dup % UnderlineY dup |
597 | 3 1 roll % X, Y, Y -> Y, X, Y |
598 | moveto % X Y moveto |
599 | % UnderlineY is on the stack |
600 | |
601 | QCONFIG /RightMarginX get |
602 | exch lineto % RightMarginX UnderlineY lineto |
603 | stroke |
604 | } |
605 | % else |
606 | { pop pop } |
607 | ifelse |
608 | } def |
609 | |
610 | /DrawQDate { |
611 | /Date (Date ) DrawQLabeline-rightmargin |
612 | } def |
613 | |
614 | /DrawQAmount { |
615 | /Amount ($ ) DrawQLabeline-rightmargin |
616 | } def |
617 | |
618 | /DrawQPayee { |
619 | % label: PAY TO THE ORDER OF |
620 | LeftMargin |
621 | QCONFIG /Payee get 1 get % PayeeY |
622 | moveto % LeftMargin PayeeY moveto |
623 | QCONFIG /PayToTheOrderOf get exec |
624 | |
625 | Underline { % if |
626 | % underline: Payee |
627 | % line goes from end of "ORDER OF" to beginning of "$ amount" |
628 | currentpoint |
629 | QCONFIG /UnderlineOffset get add % CurrentY + UnderlineOffset |
630 | newpath |
631 | dup % UnderlineY dup |
632 | 3 1 roll % X, Y, Y -> Y, X, Y |
633 | moveto % X Y moveto |
634 | % ^ UnderlineY |
635 | |
636 | QCONFIG /Amount get 0 get % AmountX |
637 | ( $ ) stringwidth pop % AdjustX |
638 | sub % PayeeLineEndX = AmountX - AdjustX |
639 | |
640 | exch lineto % PayeeLineEndX UnderlineY lineto |
641 | stroke |
642 | } if |
643 | } def |
644 | |
645 | /DrawQVerbal { |
646 | % label: Dollars |
647 | QCONFIG /RightMarginX get |
648 | ( DOLLARS) stringwidth |
649 | pop % discard yHeight |
650 | sub % RightMarginX - StringWidthX |
651 | |
652 | % ^ LabelX |
653 | |
654 | QCONFIG /Verbal get 1 get % VerbalY |
655 | 2 copy % LabelX VerbalY 2 copy |
656 | moveto % LabelX VerbalY moveto |
657 | ( DOLLARS) show |
658 | |
659 | % ^ LabelX VerbalY |
660 | |
661 | Underline { % if |
662 | newpath |
663 | QCONFIG /UnderlineOffset get add % VerbalY + UnderlineOffset |
664 | dup % dup UnderlineY |
665 | 3 1 roll % X Y Y -> Y X Y |
666 | moveto % LabelX UnderlineY moveto |
667 | |
668 | LeftMargin exch lineto % LeftMargin UnderlineY lineto |
669 | |
670 | stroke |
671 | } |
672 | % else |
673 | { pop pop } |
674 | ifelse |
675 | } def |
676 | |
677 | /DrawQMemo { |
678 | % label: Memo |
679 | LeftMargin |
680 | QCONFIG /Memo get 1 get % MemoY |
681 | moveto % LeftMargin MemoY moveto |
682 | (Memo ) show |
683 | |
684 | Underline { % if |
685 | % underline: Memo |
686 | 0 QCONFIG /UnderlineOffset get rmoveto % 0 UnderlineOffset rmoveto |
687 | currentpoint |
688 | newpath |
689 | moveto % currentpoint moveto |
690 | QCONFIG /MemoLineWidth get 0 rlineto |
691 | stroke |
692 | } if |
693 | } def |
694 | |
695 | /DrawQSignature { |
696 | QCONFIG /RightMarginX get |
697 | |
698 | % if |
699 | userdict /SignatureLineHeight known |
700 | { |
701 | SignatureLineHeight |
702 | } |
703 | % else |
704 | { |
705 | QCONFIG /Memo get 1 get % MemoY |
706 | QCONFIG /UnderlineOffset get % UnderlineOffset |
707 | add % MemoY UnderlineOffset add |
708 | } ifelse |
709 | |
710 | % ^ RightMarginX SignatureY |
711 | newpath |
712 | moveto % RightMarginX UnderlineY moveto |
713 | QCONFIG /SignatureLineWidth get neg 0 rlineto |
714 | stroke |
715 | } def |
716 | |
717 | % |
718 | % [(string) ...] boldlines DrawQInfo - |
719 | % |
720 | % Draw array of strings as separate lines of text centered and topaligned |
721 | % to the currentpoint. Null strings are skipped. If the string is non-null |
722 | % and it's index is less than boldlines, the bold font is used. |
723 | % |
724 | /DrawQInfo { |
725 | 0 % counter |
726 | false % istopaligned |
727 | % ^ [(string)] boldlines counter istopaligned |
728 | 4 -1 roll % ^ boldlines counter istopaligned [(string)] |
729 | { |
730 | % ^ boldlines counter istopaligned (string) |
731 | dup length 0 gt { % if |
732 | |
733 | % bold font if one of boldlines |
734 | 2 index % counter |
735 | 4 index % boldlines |
736 | lt { |
737 | currentfont % save font to stack |
738 | BoldFontName findfont |
739 | StandardFontSize scalefont |
740 | setfont |
741 | 5 1 roll % ^ font boldlines counter istopaligned (string) |
742 | } if |
743 | |
744 | exch % ^ (string) istopaligned |
745 | % if istopaligned |
746 | { |
747 | nextline |
748 | true % istopaligned |
749 | } |
750 | % else |
751 | { |
752 | topalign |
753 | 0 StandardFontSize neg initline |
754 | true % istopaligned |
755 | } |
756 | ifelse |
757 | |
758 | exch % ^ istopaligned (string) |
759 | centeralign show % (string) centeralign show |
760 | |
761 | % ^ boldlines counter istopaligned |
762 | |
763 | % restore font if one of boldlines |
764 | 1 index % counter |
765 | 3 index % boldlines |
766 | lt { |
767 | % ^ font boldlines counter istopaligned |
768 | 4 -1 roll % ^ boldlines counter istopaligned font |
769 | setfont % restore font from stack |
770 | } if |
771 | } |
772 | % else |
773 | { pop } % discard (string) |
774 | ifelse |
775 | |
776 | exch 1 add exch % increment counter |
777 | } forall |
778 | pop % discard istopaligned |
779 | pop % discard counter |
780 | pop % discard boldlines |
781 | } def |
782 | |
783 | /DrawQBankInfo { |
784 | QCONFIG /Date get 0 get 4 div 3 mul % DraweeX |
785 | CheckHeight TopMargin sub % DraweeY |
786 | moveto % DraweeX DraweeY moveto |
787 | [ BankName BankAddr1 BankAddr2 BankCityStateZip ] 1 DrawQInfo |
788 | } def |
789 | |
790 | /DrawQAccountHolderInfo { |
791 | QCONFIG /Date get 0 get 3 div % DraweeX |
792 | CheckHeight TopMargin sub % DrawerY |
793 | moveto % DrawerX DrawerY moveto |
794 | [ Name1 Name2 Address1 Address2 CityStateZip PhoneNumber ] 2 DrawQInfo |
795 | } def |
796 | |
797 | /DrawQCheckNumberAndFraction { |
798 | currentfont % save font to stack |
799 | CheckNumFontName findfont |
800 | CheckNumFontSize scalefont |
801 | setfont |
802 | |
803 | CheckWidth RightMargin sub % NumberX |
804 | CheckHeight TopMargin sub % NumberY |
805 | moveto % NumberX NumberY moveto |
806 | CheckNumberString topalign |
807 | 0 StandardFontSize 1.25 mul neg initline |
808 | rightalign show |
809 | nextline |
810 | |
811 | FractionFontName findfont |
812 | FractionFontSize scalefont |
813 | setfont |
814 | |
815 | Fraction topalign rightalign show |
816 | |
817 | setfont % restore font from stack |
818 | } def |
819 | |
820 | % |
821 | % LeftX RightX Y (label) DrawQStubLabeline - |
822 | % |
823 | /DrawQStubLabeline { |
824 | 4 -1 roll % ^ RightX Y (label) LeftX |
825 | 2 index % Y index |
826 | moveto % LeftX Y moveto |
827 | % ^ RightX Y (label) |
828 | show % (label) show |
829 | % ^ RightX Y |
830 | QCONFIG /UnderlineOffset get % ^ RightX Y UnderlineOffset |
831 | dup 0 exch rmoveto % Offset start of line |
832 | add % Y UnderlineOffset add |
833 | lineto % RightX Y lineto |
834 | } def |
835 | |
836 | /DrawQStub { |
837 | CheckHorOffset 2 inch ge |
838 | QCONFIG /Stub get |
839 | and { % if |
840 | gsave |
841 | |
842 | CheckHorOffset neg 0 translate |
843 | |
844 | newpath |
845 | |
846 | StandardFontName findfont |
847 | StandardFontSize 1 sub scalefont |
848 | setfont |
849 | |
850 | 0.1875 inch % ^ LeftX |
851 | dup CheckHorOffset exch sub % ^ LeftX RightX |
852 | |
853 | 2 copy % LeftX RightX |
854 | QCONFIG /StubDate get 1 get % DateY |
855 | (DATE ) |
856 | DrawQStubLabeline |
857 | |
858 | 2 copy % LeftX RightX |
859 | QCONFIG /StubPayee get 1 get % PayeeY |
860 | (PAYEE ) |
861 | DrawQStubLabeline |
862 | |
863 | 2 copy % LeftX RightX |
864 | QCONFIG /StubAmount get 1 get % AmountY |
865 | (AMOUNT ) |
866 | DrawQStubLabeline |
867 | |
868 | 2 copy % LeftX RightX |
869 | QCONFIG /StubMemo get 1 get % MemoY |
870 | (MEMO ) |
871 | DrawQStubLabeline |
872 | |
873 | 2 copy % LeftX RightX |
874 | QCONFIG /StubCategory get 1 get % CategoryY |
875 | (CATG. ) |
876 | DrawQStubLabeline |
877 | |
878 | 2 copy % LeftX RightX |
879 | QCONFIG /StubAccount get 1 get % AccountY |
880 | (ACCT. ) |
881 | DrawQStubLabeline |
882 | |
883 | Underline { stroke } if |
884 | |
885 | CheckNumFontName findfont |
886 | CheckNumFontSize scalefont |
887 | setfont |
888 | |
889 | % ^ LeftX RightX |
890 | CheckHeight TopMargin sub moveto % RightX TextTop moveto |
891 | CheckNumberString topalign rightalign show |
892 | |
893 | pop % LeftX |
894 | |
895 | grestore |
896 | } if |
897 | } def |
898 | |
899 | /DrawQCheckBody { |
900 | DrawQDate |
901 | DrawQAmount |
902 | DrawQPayee |
903 | DrawQVerbal |
904 | DrawQMemo |
905 | DrawQSignature |
906 | DrawQBankInfo |
907 | DrawQAccountHolderInfo |
908 | DrawQCheckNumberAndFraction |
909 | DrawQStub |
910 | /DrawLogo where { pop DrawLogo } if |
911 | } def |
912 | |
913 | /DrawQStandardCheckBody { |
914 | /QCONFIG QStandardConfig def |
915 | DrawQCheckBody |
916 | } def |
917 | |
918 | /DrawQWalletCheckBody { |
919 | /QCONFIG QWalletConfig def |
920 | DrawQCheckBody |
921 | } def |
922 | %%EndProcSet |
923 | |
924 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
925 | % Standard Feature Printing Routines % |
926 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
927 | |
928 | /DrawMICR { |
929 | % 0.25 high, 5.6875 from right edge should be in the middle |
930 | % of the tolerance band |
931 | CheckWidth 0.25 inch moveto |
932 | -5.6875 inch 0 inch rmoveto |
933 | MICRHorTweak MICRVerTweak rmoveto |
934 | % Now we're at the nominal start of the routing number |
935 | |
936 | MICRFontName findfont |
937 | MICRFontSize scalefont |
938 | setfont |
939 | |
940 | % Number of digits in the CheckNumberString |
941 | /CheckNumDigit CheckNumberString length 1 sub def |
942 | |
943 | CheckNumInAuxOnUs { |
944 | CheckNumEnd -1 CheckNumStart { |
945 | CheckNumDigit 0 ge { |
946 | AuxOnUs exch CheckNumberString CheckNumDigit get put |
947 | /CheckNumDigit CheckNumDigit 1 sub def |
948 | } { |
949 | AuxOnUs exch (0) 0 get put |
950 | } ifelse |
951 | } for |
952 | } if |
953 | |
954 | |
955 | AuxOnUs stringwidth pop neg 0 rmoveto |
956 | AuxOnUs show |
957 | |
958 | Routing show |
959 | |
960 | CheckNumInOnUs { |
961 | CheckNumEnd -1 CheckNumStart { |
962 | CheckNumDigit 0 ge { |
963 | OnUs exch CheckNumberString CheckNumDigit get put |
964 | /CheckNumDigit CheckNumDigit 1 sub def |
965 | } { |
966 | OnUs exch (0) 0 get put |
967 | } ifelse |
968 | } for |
969 | } if |
970 | |
971 | OnUs show |
972 | |
973 | StandardFontName findfont |
974 | StandardFontSize scalefont |
975 | setfont |
976 | } def |
977 | |
978 | |
979 | /DrawVOID { |
980 | save |
981 | StandardFontName findfont |
982 | 50 scalefont |
983 | setfont |
984 | newpath |
985 | CheckWidth 2 div 1 inch moveto |
986 | 30 rotate |
987 | (V O I D) stringwidth pop 0 moveto |
988 | (V O I D) true charpath |
989 | stroke |
990 | restore |
991 | } def |
992 | |
993 | /DrawCheck { |
994 | |
995 | % Convert CheckNumber integer to a string |
996 | CheckNumber CheckNumberString cvs |
997 | pop % discard reference to CheckNumberString |
998 | |
999 | PrintCheckBody { |
1000 | CheckLayoutDict CheckLayout get exec |
1001 | } if |
1002 | |
1003 | PrintMICRLine { |
1004 | DrawMICR |
1005 | } if |
1006 | |
1007 | PrintVOID { |
1008 | % Draw border around check, and print "VOID" for testing |
1009 | 0 0 moveto |
1010 | CheckWidth 0 lineto |
1011 | CheckWidth CheckHeight lineto |
1012 | 0 CheckHeight lineto |
1013 | |
1014 | 0 0 lineto |
1015 | |
1016 | DrawVOID |
1017 | } if |
1018 | |
1019 | } def |
1020 | |
1021 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
1022 | % Main Printing Procedure % |
1023 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
1024 | |
1025 | /CurrentPage 1 def |
1026 | |
1027 | % Replace symbol placeholders with actual glyphs |
1028 | % Also get starting and ending position for check number |
1029 | FixMICR |
1030 | |
1031 | NumPages { % repeat |
1032 | /CheckNumber CheckNumber ChecksPerPage add def |
1033 | CheckHorOffset CheckVerOffset translate |
1034 | |
1035 | StandardFontName findfont |
1036 | StandardFontSize scalefont |
1037 | setfont |
1038 | |
1039 | LineWidth setlinewidth |
1040 | |
1041 | % Loop through printing checks, starting with the bottom one |
1042 | |
1043 | ChecksPerPage { % repeat |
1044 | /CheckNumber CheckNumber 1 sub def |
1045 | newpath |
1046 | DrawCheck |
1047 | stroke |
1048 | 0 CheckHeight translate |
1049 | } repeat |
1050 | |
1051 | showpage |
1052 | |
1053 | /CheckNumber CheckNumber ChecksPerPage add def |
1054 | /CurrentPage CurrentPage 1 add def |
1055 | } repeat |
1056 | %%EOF |
1057 |
Built with git-ssb-web