Files: 0e146f91b23a1bc9553cedbc2b2908c3912a95b9 / example_check.ps.new
12233 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} def |
131 | /SignatureLineHeight {0.25} def |
132 | /AmountLineHeight {0.50} def |
133 | /PayeeLineHeight {0.60} def |
134 | /BankInfoHeight {0.45} def |
135 | /DateLineHeight {0.75} 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 CheckNumber log floor 1 add cvi 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 CheckHeight mul 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 CheckHeight mul 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 CheckHeight mul 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 CheckHeight mul lineto |
251 | } def |
252 | |
253 | /DrawAccountHolderInfo { |
254 | LeftMargin CheckHeight moveto |
255 | 0 TopMargin neg rmoveto |
256 | 0 StandardFontSize neg rmoveto |
257 | |
258 | StandardFontSize Name1 ShowAndCR |
259 | StandardFontSize Name2 ShowAndCR |
260 | |
261 | StandardFontName findfont |
262 | StandardFontSize 1 sub scalefont |
263 | setfont |
264 | |
265 | StandardFontSize 1 sub Address1 ShowAndCR |
266 | StandardFontSize 1 sub Address2 ShowAndCR |
267 | StandardFontSize 1 sub CityStateZip ShowAndCR |
268 | StandardFontSize 1 sub PhoneNumber ShowAndCR |
269 | |
270 | StandardFontName findfont |
271 | StandardFontSize 1 add scalefont |
272 | setfont |
273 | } def |
274 | |
275 | /DrawDateLine { |
276 | 0.6 CheckWidth mul DateLineHeight CheckHeight mul moveto |
277 | (Date) show |
278 | 1 inch 0 rlineto |
279 | } def |
280 | |
281 | /DrawBankInfo { |
282 | LeftMargin BankInfoHeight CheckHeight mul moveto |
283 | |
284 | StandardFontSize BankName ShowAndCR |
285 | |
286 | StandardFontName findfont |
287 | StandardFontSize 1 sub scalefont |
288 | setfont |
289 | |
290 | StandardFontSize 1 sub BankAddr1 ShowAndCR |
291 | StandardFontSize 1 sub BankAddr2 ShowAndCR |
292 | StandardFontSize 1 sub BankCityStateZip ShowAndCR |
293 | |
294 | StandardFontName findfont |
295 | StandardFontSize 1 add scalefont |
296 | setfont |
297 | } def |
298 | |
299 | /DrawPayeeLine { |
300 | |
301 | LeftMargin PayeeLineHeight CheckHeight mul moveto |
302 | (ORDER OF) show |
303 | (ORDER OF) stringwidth pop neg StandardFontSize rmoveto |
304 | (PAY TO THE) show |
305 | 0 StandardFontSize neg rmoveto |
306 | 4 0 rmoveto |
307 | currentpoint mark |
308 | |
309 | CheckWidth PayeeLineHeight CheckHeight mul moveto |
310 | RightMargin neg 0 rmoveto |
311 | AmountBoxWidth neg 0 rmoveto |
312 | |
313 | 0 AmountBoxHeight rlineto |
314 | AmountBoxWidth 0 rlineto |
315 | 0 AmountBoxHeight neg rlineto |
316 | AmountBoxWidth neg 0 rlineto |
317 | |
318 | -4 0 rmoveto |
319 | |
320 | /Helvetica-Bold findfont |
321 | 14 scalefont |
322 | setfont |
323 | |
324 | ($) stringwidth pop neg 0 rmoveto |
325 | ($) show |
326 | ($) stringwidth pop neg 0 rmoveto |
327 | |
328 | -4 0 rmoveto |
329 | cleartomark |
330 | lineto |
331 | |
332 | StandardFontName findfont |
333 | StandardFontSize scalefont |
334 | setfont |
335 | |
336 | } def |
337 | |
338 | /DrawMICR { |
339 | % 0.25 high, 5.6875 from right edge should be in the middle |
340 | % of the tolerance band |
341 | CheckWidth 0.25 inch moveto |
342 | -5.6875 inch 0 inch rmoveto |
343 | MICRHorTweak MICRVerTweak rmoveto |
344 | |
345 | save |
346 | MICRFontName findfont |
347 | MICRFontSize scalefont |
348 | setfont |
349 | % If wide check, check number goes on the left |
350 | % with OnUS symbols around it |
351 | % so pad out the zeros, move back that far + space |
352 | CheckWidth 8.00 inch ge { |
353 | (0) stringwidth pop neg |
354 | CheckNumDigits mul |
355 | 3 add %2 OnUs symbols + space |
356 | 0 rmoveto |
357 | OnUsSymbol show |
358 | CheckNumDigits CheckNumberString length sub |
359 | { (0) show } repeat |
360 | CheckNumberString show |
361 | OnUsSymbol show |
362 | ( ) show |
363 | } if |
364 | TransitSymbol show |
365 | RoutingNumber show |
366 | TransitSymbol show |
367 | ( ) show |
368 | % Pad with spaces if acct number is short |
369 | 12 AccountNumber length sub {( ) show} repeat |
370 | AccountNumber show |
371 | OnUsSymbol show |
372 | ( ) show |
373 | % If we have a short check, check number goes here |
374 | CheckWidth 8.00 inch lt { |
375 | % Same deal, pad w/ 0s if short check number |
376 | CheckNumDigits CheckNumberString length sub |
377 | { (0) show } repeat |
378 | CheckNumberString show |
379 | } if |
380 | restore |
381 | } def |
382 | |
383 | /DrawCheckNumber { |
384 | CheckWidth CheckHeight moveto |
385 | RightMargin neg TopMargin neg rmoveto |
386 | CheckNumFont findfont |
387 | CheckNumSize scalefont |
388 | setfont |
389 | |
390 | CheckNumberString stringwidth pop neg 0 rmoveto |
391 | 0 -14 rmoveto |
392 | CheckNumberString show |
393 | |
394 | StandardFontName findfont |
395 | StandardFontSize scalefont |
396 | setfont |
397 | } def |
398 | |
399 | /DrawFraction { |
400 | 0.6 CheckWidth mul CheckHeight moveto |
401 | 0 TopMargin neg rmoveto |
402 | 0 StandardFontSize neg rmoveto |
403 | Fraction show |
404 | } def |
405 | |
406 | /DrawStub { |
407 | CheckHorOffset 2 inch ge { |
408 | save |
409 | newpath |
410 | CheckHorOffset neg 0 translate |
411 | StandardFontName findfont |
412 | StandardFontSize 1 sub scalefont |
413 | setfont |
414 | /StubSpacing {CheckHeight 6 div} def |
415 | CheckHorOffset 2 div StubSpacing 5 mul moveto |
416 | CheckNumberString show |
417 | 0.3 inch StubSpacing 4 mul moveto |
418 | (Date ) show |
419 | CheckHorOffset 0.3 inch sub StubSpacing 4 mul lineto |
420 | 0.3 inch StubSpacing 3 mul moveto |
421 | (Payee ) show |
422 | CheckHorOffset 0.3 inch sub StubSpacing 3 mul lineto |
423 | 0.3 inch StubSpacing 2 mul moveto |
424 | (Amount ) show |
425 | CheckHorOffset 0.3 inch sub StubSpacing 2 mul lineto |
426 | 0.3 inch StubSpacing 1 mul moveto |
427 | (Memo ) show |
428 | CheckHorOffset 0.3 inch sub StubSpacing 1 mul lineto |
429 | stroke |
430 | restore |
431 | } if |
432 | } def |
433 | |
434 | /DrawVOID { |
435 | save |
436 | StandardFontName findfont |
437 | 50 scalefont |
438 | setfont |
439 | newpath |
440 | CheckWidth 2 div 1 inch moveto |
441 | 30 rotate |
442 | (V O I D) stringwidth pop 0 moveto |
443 | (V O I D) true charpath |
444 | stroke |
445 | restore |
446 | } def |
447 | |
448 | /DrawCheck { |
449 | |
450 | % Convert CheckNumber integer to a string |
451 | CheckNumber CheckNumberString cvs |
452 | PrintCheckBody { |
453 | DrawBankInfo |
454 | DrawAccountHolderInfo |
455 | DrawMemoLine |
456 | DrawSignatureLine |
457 | DrawAmountLine |
458 | DrawPayeeLine |
459 | DrawCheckNumber |
460 | DrawFraction |
461 | DrawDateLine |
462 | DrawStub |
463 | } if |
464 | |
465 | PrintMICRLine { |
466 | DrawMICR |
467 | } if |
468 | |
469 | PrintVOID { |
470 | % Draw border around check, and print "VOID" for testing |
471 | 0 0 moveto |
472 | CheckWidth 0 lineto |
473 | CheckWidth CheckHeight lineto |
474 | 0 CheckHeight lineto |
475 | 0 0 lineto |
476 | |
477 | DrawVOID |
478 | } if |
479 | |
480 | } def |
481 | |
482 | |
483 | /CurrentPage 1 def |
484 | |
485 | NumPages -1 1 { |
486 | /CheckNumber CheckNumber ChecksPerPage add def |
487 | CheckHorOffset CheckVerOffset translate |
488 | |
489 | StandardFontName findfont |
490 | StandardFontSize scalefont |
491 | setfont |
492 | |
493 | LineWidth setlinewidth |
494 | |
495 | % Loop through printing checks, starting with the bottom one |
496 | |
497 | ChecksPerPage -1 1 { |
498 | /CheckNumber CheckNumber 1 sub def |
499 | newpath |
500 | DrawCheck |
501 | stroke |
502 | 0 CheckHeight translate |
503 | } for |
504 | |
505 | showpage |
506 | /CheckNumber CheckNumber ChecksPerPage add def |
507 | /CurrentPage CurrentPage 1 add def |
508 | |
509 | } for |
510 | |
511 |
Built with git-ssb-web