Files: 6100c2a5d781d1ac261195db53af7fa6685e1e10 / example_check.ps
12415 bytesRaw
1 | %! |
2 | %--------------- |
3 | % |
4 | % FreeCheck - a free check printing application released |
5 | % under the GNU General Public Licene. |
6 | % |
7 | % Copyright (C) 2000 Eric Sandeen (eric_sandeen@bigfoot.com) |
8 | % |
9 | % This program is free software; you can redistribute it and/or modify |
10 | % it under the terms of the GNU General Public License as published by |
11 | % the Free Software Foundation; either version 2 of the License, or |
12 | % (at your option) any later version. |
13 | % |
14 | % This program is distributed in the hope that it will be useful, |
15 | % but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 | % GNU General Public License for more details. |
18 | % |
19 | % You should have received a copy of the GNU General Public License |
20 | % along with this program; if not, write to the Free Software |
21 | % Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
22 | % |
23 | %--------------- |
24 | |
25 | % Let's get this out of the way first: |
26 | /inch {72 mul} def |
27 | |
28 | %%%%%%%%%%%%%%%%%%%%% |
29 | % Account info % |
30 | % Text on the check % |
31 | % (The Account File)% |
32 | %%%%%%%%%%%%%%%%%%%%% |
33 | |
34 | |
35 | % Things to define at each printing |
36 | % --------------------------------- |
37 | % --------------------------------- |
38 | |
39 | % Check number |
40 | % ------------ |
41 | % Check number for first check on the page |
42 | |
43 | /CheckNumber 100 def |
44 | |
45 | % Parts to print |
46 | % -------------- |
47 | % What exactly do we want to print? This is so that people can use |
48 | % special MICR toner if they want, and print two-pass |
49 | |
50 | /PrintCheckBody true def |
51 | /PrintMICRLine true def |
52 | |
53 | % Number of pages to print |
54 | /NumPages 3 def |
55 | |
56 | % Prints a big VOID over the check |
57 | /PrintVOID false def |
58 | |
59 | % Basic account information |
60 | % ------------------------- |
61 | % ------------------------- |
62 | |
63 | % Account Holder's Name, etc |
64 | % -------------------------- |
65 | % If Name2 or Address2 are empty, they will not be printed |
66 | |
67 | /Name1 (JOHN SMITH) def |
68 | /Name2 (MARY SMITH) def |
69 | /Address1 (1234 Main Street) def |
70 | /Address2 () def |
71 | /CityStateZip (Anytown, USA 12345) def |
72 | /PhoneNumber (512-555-1212) def |
73 | |
74 | % Bank information |
75 | % ---------------- |
76 | % If BankAddr2 is empty, it will not be printed |
77 | |
78 | /BankName (GlobalMegaCorp, NA) def |
79 | /BankAddr1 (123 Main Street) def |
80 | /BankAddr2 (PO Box 45) def |
81 | /BankCityStateZip (Anytown, USA 12345) def |
82 | |
83 | % Account Information |
84 | % ------------------- |
85 | |
86 | /RoutingNumber (012345678) def % Leftmost MICR numbers |
87 | /AccountNumber (1234567890) def % Middle MICR numbers |
88 | /Fraction (12345/67890) def % Fraction at top of check |
89 | |
90 | % MICR Line placement "Tweaking" |
91 | %------------------------------- |
92 | % We add the MICR tweaking here (rather than in the check |
93 | % blank definition) because it's likely the user will |
94 | % need to change this. The blank definition may not be |
95 | % writeable by the user |
96 | |
97 | /MICRVerTweak {0} def |
98 | /MICRHorTweak {0} def |
99 | |
100 | %%%%%%%%%%%%%%%%%%%%%%%%% |
101 | % Check Style % |
102 | % Fonts and Layout Info % |
103 | % (The Style File) % |
104 | %%%%%%%%%%%%%%%%%%%%%%%%% |
105 | |
106 | % Font Names & Sizes |
107 | % ------------------ |
108 | % The StandardFontSize is just the basic size for non-MICR |
109 | % text. Things get scaled a bit from there (Names are larger than |
110 | % addresses, etc) |
111 | |
112 | /StandardFontName /AvantGarde-Book def |
113 | /StandardFontSize 9 def |
114 | |
115 | % This is NOT THE MICR FONT! It is the check number on top right |
116 | /CheckNumFont /Helvetica-Bold def |
117 | /CheckNumSize 14 def |
118 | |
119 | % Margins, etc, within the check itself |
120 | % ------------------------------------- |
121 | |
122 | /LeftMargin {0.2 inch} def |
123 | /RightMargin {0.4 inch} def |
124 | /TopMargin {0.2 inch} def |
125 | |
126 | % Check feature placement |
127 | % ----------------------- |
128 | % (relative to bottom left corner of check) |
129 | |
130 | /MemoLineHeight {0.25 CheckHeight mul} def |
131 | /SignatureLineHeight {0.25 CheckHeight mul} def |
132 | /AmountLineHeight {0.50 CheckHeight mul} def |
133 | /PayeeLineHeight {0.60 CheckHeight mul} def |
134 | /BankInfoHeight {0.45 CheckHeight mul} def |
135 | /DateLineHeight {0.75 CheckHeight mul} def |
136 | |
137 | %%%%%%%%%%%%%%%%%%%%%%%%%% |
138 | % Check Blank Dimensions % |
139 | % (The Check Blank File) % |
140 | %%%%%%%%%%%%%%%%%%%%%%%%%% |
141 | |
142 | % Information about how the checks are laid out on the page |
143 | % --------------------------------------------------------- |
144 | |
145 | /CheckHeight {2.85 inch} def |
146 | /CheckWidth {5.96 inch} def |
147 | /CheckHorOffset {2.54 inch} def % how far are checks from left edge of sheet |
148 | /CheckVerOffset {2.48 inch} def % how far is bottom check from bottom of sheet |
149 | /ChecksPerPage {3} def % How many checks are on the sheet? (vertical) |
150 | |
151 | %%%%%%%%%%%%%%%%%%%%%%% |
152 | % Global Setup Values % |
153 | %%%%%%%%%%%%%%%%%%%%%%% |
154 | |
155 | % MICR Font |
156 | % --------- |
157 | % For the MICR font, SIZE MATTERS! Make sure you have the right point |
158 | % size for the particular MICR font you're using. Most (including |
159 | % GnuMICR) are correct at 12 pts, but READ THE DOCS THAT CAME WITH |
160 | % THE FONT! :) |
161 | |
162 | /MICRFontName /GnuMICR def |
163 | /MICRFontSize 12 def |
164 | |
165 | % MICR Symbol Mapping |
166 | % ------------------- |
167 | % Maps which characters show which MICR symbols in the font you're using |
168 | % Approximate representations of these symbols, with names, below: |
169 | % |: = TransitNumberSymbol |
170 | % / = Amount |
171 | % P = OnUs |
172 | % - = Dash |
173 | |
174 | /TransitSymbol (A) def |
175 | /OnUsSymbol (C) def |
176 | /AmountSymbol (B) def |
177 | /DashSymbol (D) def |
178 | |
179 | % MICR Line placement |
180 | % ------------------- |
181 | % This should be smack in the middle of the tolerance band... |
182 | % Tweaks are accomplished by the user in the Global section |
183 | |
184 | /MICRLineHeight {0.25 inch} def |
185 | |
186 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
187 | % End of user entered information % |
188 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
189 | |
190 | % Other Constants: |
191 | |
192 | % Size of the rectangular box for the amount (digits) |
193 | /AmountBoxWidth {1 inch} def |
194 | /AmountBoxHeight {0.25 inch} def |
195 | |
196 | /LineWidth {0.3} def |
197 | |
198 | % Max number of digits in check number, and allocate string |
199 | /CheckNumDigits 4 def |
200 | /CheckNumberString CheckNumDigits string def |
201 | |
202 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
203 | % Helpful Printing Routines % |
204 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
205 | |
206 | % Shows a line, then does a "carriage return / line feed" |
207 | % But only if the string exists (more than 0 chars) |
208 | % (How do we get the current font size (height)?) |
209 | |
210 | /ShowAndCR { |
211 | % A couple copies of the string (now 3 on stack) |
212 | dup dup |
213 | length 0 gt { % First copy |
214 | show % Second copy |
215 | stringwidth pop neg 0 rmoveto % Third copy & move back |
216 | neg 0 exch rmoveto % line down |
217 | } if |
218 | } def |
219 | |
220 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
221 | % Feature Printing Routines % |
222 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
223 | |
224 | /DrawMemoLine { |
225 | LeftMargin MemoLineHeight moveto |
226 | 2.5 inch 0 inch rlineto |
227 | -2.5 inch 0 inch rmoveto |
228 | 0 2 rmoveto |
229 | (for) show |
230 | } def |
231 | |
232 | /DrawSignatureLine { % Expects height of signature line |
233 | % and right edge of check for |
234 | % beginning position |
235 | |
236 | CheckWidth SignatureLineHeight moveto |
237 | RightMargin neg 0 rmoveto |
238 | -2.5 inch 0 rmoveto |
239 | 2.5 inch 0 inch rlineto |
240 | |
241 | } def |
242 | |
243 | /DrawAmountLine { |
244 | CheckWidth AmountLineHeight moveto |
245 | RightMargin neg 0 rmoveto |
246 | (DOLLARS) stringwidth pop neg 0 rmoveto |
247 | (DOLLARS) show |
248 | (DOLLARS) stringwidth pop neg 0 rmoveto |
249 | -2 0 rmoveto |
250 | LeftMargin AmountLineHeight lineto |
251 | } def |
252 | |
253 | /DrawAccountHolderInfo { |
254 | LeftMargin CheckHeight moveto |
255 | 0 TopMargin neg rmoveto |
256 | 0 StandardFontSize neg rmoveto |
257 | |
258 | |
259 | StandardFontSize Name1 ShowAndCR |
260 | %Name1 show |
261 | %Name1 stringwidth pop neg StandardFontSize neg rmoveto |
262 | |
263 | |
264 | StandardFontSize Name2 ShowAndCR |
265 | % Show Name2 only if present |
266 | %Name2 length 0 gt { |
267 | % Name2 show |
268 | % Name2 stringwidth pop neg StandardFontSize neg rmoveto |
269 | %} if |
270 | |
271 | StandardFontName findfont |
272 | StandardFontSize 1 sub scalefont |
273 | setfont |
274 | |
275 | StandardFontSize 1 sub Address1 ShowAndCR |
276 | %Address1 stringwidth pop neg StandardFontSize neg rmoveto |
277 | |
278 | % Show Address2 only if present |
279 | Address2 length 0 gt { |
280 | Address2 show |
281 | Address2 stringwidth pop neg StandardFontSize neg rmoveto |
282 | } if |
283 | |
284 | CityStateZip show |
285 | CityStateZip stringwidth pop neg StandardFontSize neg rmoveto |
286 | |
287 | % Show PhoneNumber only if present |
288 | PhoneNumber length 0 gt { |
289 | PhoneNumber show |
290 | PhoneNumber stringwidth pop neg StandardFontSize neg rmoveto |
291 | } if |
292 | |
293 | StandardFontName findfont |
294 | StandardFontSize 1 add scalefont |
295 | setfont |
296 | } def |
297 | |
298 | /DrawDateLine { |
299 | 0.6 CheckWidth mul DateLineHeight moveto |
300 | (Date) show |
301 | 1 inch 0 rlineto |
302 | } def |
303 | |
304 | /DrawBankInfo { |
305 | LeftMargin BankInfoHeight moveto |
306 | |
307 | BankName show |
308 | BankName stringwidth pop neg StandardFontSize neg rmoveto |
309 | |
310 | StandardFontName findfont |
311 | StandardFontSize 1 sub scalefont |
312 | setfont |
313 | |
314 | BankAddr1 show |
315 | BankAddr1 stringwidth pop neg StandardFontSize neg rmoveto |
316 | |
317 | % Show Addr2 only if present |
318 | BankAddr2 length 0 gt { |
319 | BankAddr2 show |
320 | BankAddr2 stringwidth pop neg StandardFontSize neg rmoveto |
321 | } if |
322 | |
323 | BankCityStateZip show |
324 | BankCityStateZip stringwidth pop neg StandardFontSize neg rmoveto |
325 | |
326 | StandardFontName findfont |
327 | StandardFontSize 1 add scalefont |
328 | setfont |
329 | } def |
330 | |
331 | /DrawPayeeLine { |
332 | |
333 | LeftMargin PayeeLineHeight moveto |
334 | (ORDER OF) show |
335 | (ORDER OF) stringwidth pop neg StandardFontSize rmoveto |
336 | (PAY TO THE) show |
337 | 0 StandardFontSize neg rmoveto |
338 | 4 0 rmoveto |
339 | currentpoint mark |
340 | |
341 | CheckWidth PayeeLineHeight moveto |
342 | RightMargin neg 0 rmoveto |
343 | AmountBoxWidth neg 0 rmoveto |
344 | |
345 | 0 AmountBoxHeight rlineto |
346 | AmountBoxWidth 0 rlineto |
347 | 0 AmountBoxHeight neg rlineto |
348 | AmountBoxWidth neg 0 rlineto |
349 | |
350 | -4 0 rmoveto |
351 | |
352 | /Helvetica-Bold findfont |
353 | 14 scalefont |
354 | setfont |
355 | |
356 | ($) stringwidth pop neg 0 rmoveto |
357 | ($) show |
358 | ($) stringwidth pop neg 0 rmoveto |
359 | |
360 | -4 0 rmoveto |
361 | cleartomark |
362 | lineto |
363 | |
364 | StandardFontName findfont |
365 | StandardFontSize scalefont |
366 | setfont |
367 | |
368 | } def |
369 | |
370 | /DrawMICR { |
371 | % 0.25 high, 5.6875 from right edge should be in the middle |
372 | % of the tolerance band |
373 | CheckWidth 0.25 inch moveto |
374 | -5.6875 inch 0 inch rmoveto |
375 | MICRHorTweak MICRVerTweak rmoveto |
376 | |
377 | save |
378 | MICRFontName findfont |
379 | MICRFontSize scalefont |
380 | setfont |
381 | TransitSymbol show |
382 | RoutingNumber show |
383 | TransitSymbol show |
384 | ( ) show |
385 | % Pad with spaces if acct number is short |
386 | 12 AccountNumber length sub {( ) show} repeat |
387 | AccountNumber show |
388 | OnUsSymbol show |
389 | ( ) show |
390 | % Same deal, pad w/ 0s if short check number |
391 | CheckNumDigits 1 sub -1 1 |
392 | {CheckNumberString exch get 0 eq {(0) show} if } for |
393 | CheckNumberString show |
394 | restore |
395 | } def |
396 | |
397 | /DrawCheckNumber { |
398 | CheckWidth CheckHeight moveto |
399 | RightMargin neg TopMargin neg rmoveto |
400 | CheckNumFont findfont |
401 | CheckNumSize scalefont |
402 | setfont |
403 | |
404 | CheckNumberString stringwidth pop neg 0 rmoveto |
405 | 0 -14 rmoveto |
406 | CheckNumberString show |
407 | |
408 | StandardFontName findfont |
409 | StandardFontSize scalefont |
410 | setfont |
411 | } def |
412 | |
413 | /DrawFraction { |
414 | 0.6 CheckWidth mul CheckHeight moveto |
415 | 0 TopMargin neg rmoveto |
416 | 0 StandardFontSize neg rmoveto |
417 | Fraction show |
418 | } def |
419 | |
420 | /DrawStub { |
421 | CheckHorOffset 2 inch ge { |
422 | save |
423 | newpath |
424 | CheckHorOffset neg 0 translate |
425 | StandardFontName findfont |
426 | StandardFontSize 1 sub scalefont |
427 | setfont |
428 | /StubSpacing {CheckHeight 6 div} def |
429 | CheckHorOffset 2 div StubSpacing 5 mul moveto |
430 | CheckNumberString show |
431 | 0.3 inch StubSpacing 4 mul moveto |
432 | (Date ) show |
433 | CheckHorOffset 0.3 inch sub StubSpacing 4 mul lineto |
434 | 0.3 inch StubSpacing 3 mul moveto |
435 | (Payee ) show |
436 | CheckHorOffset 0.3 inch sub StubSpacing 3 mul lineto |
437 | 0.3 inch StubSpacing 2 mul moveto |
438 | (Amount ) show |
439 | CheckHorOffset 0.3 inch sub StubSpacing 2 mul lineto |
440 | 0.3 inch StubSpacing 1 mul moveto |
441 | (Memo ) show |
442 | CheckHorOffset 0.3 inch sub StubSpacing 1 mul lineto |
443 | stroke |
444 | restore |
445 | } if |
446 | } def |
447 | |
448 | /DrawVOID { |
449 | save |
450 | StandardFontName findfont |
451 | 50 scalefont |
452 | setfont |
453 | newpath |
454 | CheckWidth 2 div 1 inch moveto |
455 | 30 rotate |
456 | (V O I D) stringwidth pop 0 moveto |
457 | (V O I D) true charpath |
458 | stroke |
459 | restore |
460 | } def |
461 | |
462 | /DrawCheck { |
463 | % Temporarily draw boxes around the checks |
464 | 0 0 moveto |
465 | CheckWidth 0 lineto |
466 | CheckWidth CheckHeight lineto |
467 | 0 CheckHeight lineto |
468 | 0 0 lineto |
469 | |
470 | % Convert CheckNumber integer to a string |
471 | PrintCheckBody { |
472 | CheckNumber CheckNumberString cvs |
473 | DrawBankInfo |
474 | DrawAccountHolderInfo |
475 | DrawMemoLine |
476 | DrawSignatureLine |
477 | DrawAmountLine |
478 | DrawPayeeLine |
479 | DrawCheckNumber |
480 | DrawFraction |
481 | DrawDateLine |
482 | } if |
483 | |
484 | PrintMICRLine { |
485 | DrawMICR |
486 | } if |
487 | |
488 | PrintVOID { |
489 | DrawVOID |
490 | } if |
491 | |
492 | } def |
493 | |
494 | |
495 | /CurrentPage 1 def |
496 | |
497 | NumPages -1 1 { |
498 | /CheckNumber CheckNumber ChecksPerPage add def |
499 | CheckHorOffset CheckVerOffset translate |
500 | |
501 | StandardFontName findfont |
502 | StandardFontSize scalefont |
503 | setfont |
504 | |
505 | LineWidth setlinewidth |
506 | |
507 | % Loop through printing checks, starting with the bottom one |
508 | |
509 | ChecksPerPage -1 1 { |
510 | /CheckNumber CheckNumber 1 sub def |
511 | newpath |
512 | |
513 | DrawCheck |
514 | DrawStub % But only if there is room |
515 | |
516 | stroke |
517 | 0 CheckHeight translate |
518 | } for |
519 | |
520 | showpage |
521 | /CheckNumber CheckNumber ChecksPerPage add def |
522 | /CurrentPage CurrentPage 1 add def |
523 | |
524 | } for |
525 |
Built with git-ssb-web