%! %--------------- % % FreeCheck - a free check printing application released % under the GNU General Public Licene. % % Copyright (C) 2000 Eric Sandeen (eric_sandeen@bigfoot.com) % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; if not, write to the Free Software % Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. % %--------------- % Let's get this out of the way first: /inch {72 mul} def %%%%%%%%%%%%%%%%%%%%% % Account info % % Text on the check % % (The Account File)% %%%%%%%%%%%%%%%%%%%%% % Things to define at each printing % --------------------------------- % --------------------------------- % Check number % ------------ % Check number for first check on the page /CheckNumber 100 def % Parts to print % -------------- % What exactly do we want to print? This is so that people can use % special MICR toner if they want, and print two-pass /PrintCheckBody true def /PrintMICRLine true def % Number of pages to print /NumPages 3 def % Prints a big VOID over the check /PrintVOID true def % Basic account information % ------------------------- % ------------------------- % Account Holder's Name, etc % -------------------------- % If Name2 or Address2 are empty, they will not be printed /Name1 (JOHN SMITH) def /Name2 (MARY SMITH) def /Address1 (1234 Main Street) def /Address2 () def /CityStateZip (Anytown, USA 12345) def /PhoneNumber (512-555-1212) def % Bank information % ---------------- % If BankAddr2 is empty, it will not be printed /BankName (GlobalMegaCorp, NA) def /BankAddr1 (123 Main Street) def /BankAddr2 (PO Box 45) def /BankCityStateZip (Anytown, USA 12345) def % Account Information % ------------------- /RoutingNumber (012345678) def % Leftmost MICR numbers /AccountNumber (1234567890) def % Middle MICR numbers /Fraction (12345/67890) def % Fraction at top of check % MICR Line placement "Tweaking" %------------------------------- % We add the MICR tweaking here (rather than in the check % blank definition) because it's likely the user will % need to change this. The blank definition may not be % writeable by the user /MICRVerTweak {0} def /MICRHorTweak {0} def %%%%%%%%%%%%%%%%%%%%%%%%% % Check Style % % Fonts and Layout Info % % (The Style File) % %%%%%%%%%%%%%%%%%%%%%%%%% % Font Names & Sizes % ------------------ % The StandardFontSize is just the basic size for non-MICR % text. Things get scaled a bit from there (Names are larger than % addresses, etc) /StandardFontName /AvantGarde-Book def /StandardFontSize 9 def % This is NOT THE MICR FONT! It is the check number on top right /CheckNumFont /Helvetica-Bold def /CheckNumSize 14 def % Margins, etc, within the check itself % ------------------------------------- /LeftMargin {0.2 inch} def /RightMargin {0.4 inch} def /TopMargin {0.2 inch} def % Check feature placement % ----------------------- % (relative to bottom left corner of check) /MemoLineHeight {0.25} def /SignatureLineHeight {0.25} def /AmountLineHeight {0.50} def /PayeeLineHeight {0.60} def /BankInfoHeight {0.45} def /DateLineHeight {0.75} def %%%%%%%%%%%%%%%%%%%%%%%%%% % Check Blank Dimensions % % (The Check Blank File) % %%%%%%%%%%%%%%%%%%%%%%%%%% % Information about how the checks are laid out on the page % --------------------------------------------------------- /CheckHeight {2.85 inch} def /CheckWidth {5.96 inch} def /CheckHorOffset {2.52 inch} def % how far are checks from left edge of sheet /CheckVerOffset {2.48 inch} def % how far is bottom check from bottom of sheet /ChecksPerPage {3} def % How many checks are on the sheet? (vertical) %%%%%%%%%%%%%%%%%%%%%%% % Global Setup Values % %%%%%%%%%%%%%%%%%%%%%%% % MICR Font % --------- % For the MICR font, SIZE MATTERS! Make sure you have the right point % size for the particular MICR font you're using. Most (including % GnuMICR) are correct at 12 pts, but READ THE DOCS THAT CAME WITH % THE FONT! :) /MICRFontName /GnuMICR def /MICRFontSize 12 def % MICR Symbol Mapping % ------------------- % Maps which characters show which MICR symbols in the font you're using % Approximate representations of these symbols, with names, below: % |: = TransitNumberSymbol % / = Amount % P = OnUs % - = Dash /TransitSymbol (A) def /OnUsSymbol (C) def /AmountSymbol (B) def /DashSymbol (D) def % MICR Line placement % ------------------- % This should be smack in the middle of the tolerance band... % Tweaks are accomplished by the user in the Global section /MICRLineHeight {0.25 inch} def %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % End of user entered information % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Other Constants: % Size of the rectangular box for the amount (digits) /AmountBoxWidth {1 inch} def /AmountBoxHeight {0.25 inch} def /LineWidth {0.3} def % Max number of digits in check number, and allocate string /CheckNumDigits 4 def /CheckNumberString CheckNumber log floor 1 add cvi string def %%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Helpful Printing Routines % %%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Shows a line, then does a "carriage return / line feed" % But only if the string exists (more than 0 chars) % (How do we get the current font size (height)?) /ShowAndCR { % A couple copies of the string (now 3 on stack) dup dup length 0 gt { % First copy show % Second copy stringwidth pop neg 0 rmoveto % Third copy & move back neg 0 exch rmoveto % line down } if } def %%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Feature Printing Routines % %%%%%%%%%%%%%%%%%%%%%%%%%%%%% /DrawMemoLine { LeftMargin MemoLineHeight CheckHeight mul moveto 2.5 inch 0 inch rlineto -2.5 inch 0 inch rmoveto 0 2 rmoveto (for) show } def /DrawSignatureLine { % Expects height of signature line % and right edge of check for % beginning position CheckWidth SignatureLineHeight CheckHeight mul moveto RightMargin neg 0 rmoveto -2.5 inch 0 rmoveto 2.5 inch 0 inch rlineto } def /DrawAmountLine { CheckWidth AmountLineHeight CheckHeight mul moveto RightMargin neg 0 rmoveto (DOLLARS) stringwidth pop neg 0 rmoveto (DOLLARS) show (DOLLARS) stringwidth pop neg 0 rmoveto -2 0 rmoveto LeftMargin AmountLineHeight CheckHeight mul lineto } def /DrawAccountHolderInfo { LeftMargin CheckHeight moveto 0 TopMargin neg rmoveto 0 StandardFontSize neg rmoveto StandardFontSize Name1 ShowAndCR StandardFontSize Name2 ShowAndCR StandardFontName findfont StandardFontSize 1 sub scalefont setfont StandardFontSize 1 sub Address1 ShowAndCR StandardFontSize 1 sub Address2 ShowAndCR StandardFontSize 1 sub CityStateZip ShowAndCR StandardFontSize 1 sub PhoneNumber ShowAndCR StandardFontName findfont StandardFontSize 1 add scalefont setfont } def /DrawDateLine { 0.6 CheckWidth mul DateLineHeight CheckHeight mul moveto (Date) show 1 inch 0 rlineto } def /DrawBankInfo { LeftMargin BankInfoHeight CheckHeight mul moveto StandardFontSize BankName ShowAndCR StandardFontName findfont StandardFontSize 1 sub scalefont setfont StandardFontSize 1 sub BankAddr1 ShowAndCR StandardFontSize 1 sub BankAddr2 ShowAndCR StandardFontSize 1 sub BankCityStateZip ShowAndCR StandardFontName findfont StandardFontSize 1 add scalefont setfont } def /DrawPayeeLine { LeftMargin PayeeLineHeight CheckHeight mul moveto (ORDER OF) show (ORDER OF) stringwidth pop neg StandardFontSize rmoveto (PAY TO THE) show 0 StandardFontSize neg rmoveto 4 0 rmoveto currentpoint mark CheckWidth PayeeLineHeight CheckHeight mul moveto RightMargin neg 0 rmoveto AmountBoxWidth neg 0 rmoveto 0 AmountBoxHeight rlineto AmountBoxWidth 0 rlineto 0 AmountBoxHeight neg rlineto AmountBoxWidth neg 0 rlineto -4 0 rmoveto /Helvetica-Bold findfont 14 scalefont setfont ($) stringwidth pop neg 0 rmoveto ($) show ($) stringwidth pop neg 0 rmoveto -4 0 rmoveto cleartomark lineto StandardFontName findfont StandardFontSize scalefont setfont } def /DrawMICR { % 0.25 high, 5.6875 from right edge should be in the middle % of the tolerance band CheckWidth 0.25 inch moveto -5.6875 inch 0 inch rmoveto MICRHorTweak MICRVerTweak rmoveto save MICRFontName findfont MICRFontSize scalefont setfont % If wide check, check number goes on the left % with OnUS symbols around it % so pad out the zeros, move back that far + space CheckWidth 8.00 inch ge { (0) stringwidth pop neg CheckNumDigits mul 3 add %2 OnUs symbols + space 0 rmoveto OnUsSymbol show CheckNumDigits CheckNumberString length sub { (0) show } repeat CheckNumberString show OnUsSymbol show ( ) show } if TransitSymbol show RoutingNumber show TransitSymbol show ( ) show % Pad with spaces if acct number is short 12 AccountNumber length sub {( ) show} repeat AccountNumber show OnUsSymbol show ( ) show % If we have a short check, check number goes here CheckWidth 8.00 inch lt { % Same deal, pad w/ 0s if short check number CheckNumDigits CheckNumberString length sub { (0) show } repeat CheckNumberString show } if restore } def /DrawCheckNumber { CheckWidth CheckHeight moveto RightMargin neg TopMargin neg rmoveto CheckNumFont findfont CheckNumSize scalefont setfont CheckNumberString stringwidth pop neg 0 rmoveto 0 -14 rmoveto CheckNumberString show StandardFontName findfont StandardFontSize scalefont setfont } def /DrawFraction { 0.6 CheckWidth mul CheckHeight moveto 0 TopMargin neg rmoveto 0 StandardFontSize neg rmoveto Fraction show } def /DrawStub { CheckHorOffset 2 inch ge { save newpath CheckHorOffset neg 0 translate StandardFontName findfont StandardFontSize 1 sub scalefont setfont /StubSpacing {CheckHeight 6 div} def CheckHorOffset 2 div StubSpacing 5 mul moveto CheckNumberString show 0.3 inch StubSpacing 4 mul moveto (Date ) show CheckHorOffset 0.3 inch sub StubSpacing 4 mul lineto 0.3 inch StubSpacing 3 mul moveto (Payee ) show CheckHorOffset 0.3 inch sub StubSpacing 3 mul lineto 0.3 inch StubSpacing 2 mul moveto (Amount ) show CheckHorOffset 0.3 inch sub StubSpacing 2 mul lineto 0.3 inch StubSpacing 1 mul moveto (Memo ) show CheckHorOffset 0.3 inch sub StubSpacing 1 mul lineto stroke restore } if } def /DrawVOID { save StandardFontName findfont 50 scalefont setfont newpath CheckWidth 2 div 1 inch moveto % 30 rotate % (V O I D) stringwidth pop 0 moveto % (V O I D) true charpath stroke restore } def /DrawCheck { % Convert CheckNumber integer to a string CheckNumber CheckNumberString cvs PrintCheckBody { DrawBankInfo DrawAccountHolderInfo DrawMemoLine DrawSignatureLine DrawAmountLine DrawPayeeLine DrawCheckNumber DrawFraction DrawDateLine DrawStub } if PrintMICRLine { DrawMICR } if PrintVOID { % Draw border around check, and print "VOID" for testing 0 0 moveto CheckWidth 0 lineto CheckWidth CheckHeight lineto 0 CheckHeight lineto 0 0 lineto DrawVOID } if } def /CurrentPage 1 def NumPages -1 1 { /CheckNumber CheckNumber ChecksPerPage add def CheckHorOffset CheckVerOffset translate StandardFontName findfont StandardFontSize scalefont setfont LineWidth setlinewidth % Loop through printing checks, starting with the bottom one ChecksPerPage -1 1 { /CheckNumber CheckNumber 1 sub def newpath DrawCheck stroke 0 CheckHeight translate } for showpage /CheckNumber CheckNumber ChecksPerPage add def /CurrentPage CurrentPage 1 add def } for