home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 September / Simtel20_Sept92.cdr / msdos / laser / postprn.arc / PORT4.PS < prev    next >
Text File  |  1989-06-02  |  3KB  |  158 lines

  1. %!
  2.  
  3. %
  4. % Four-Up Portrait Page Printer
  5. %
  6.  
  7. /inch {72 mul} def
  8. /pageheight 11 inch def
  9. /pagewidth 8.5 inch def
  10.  
  11. /ttop 10.7 inch def
  12. /tbot 5.6 inch def
  13. /btop 5.4 inch def
  14. /bbot .3 inch def
  15.  
  16. /lleft .3 inch def
  17. /rleft 4.35 inch def
  18.  
  19. /lmarg lleft def
  20. /tmarg ttop def
  21. /bmarg tbot def
  22.  
  23. /lincr 5.6 def
  24.  
  25. /x lmarg def
  26. /y tmarg def
  27. /pg 0 def
  28. /xw 0 def
  29. /yw 0 def
  30. /i currentfile def
  31. /s 1000 string def
  32. /ones 1 string def
  33.  
  34. /lastFF 0 def
  35. /page_text 0 def    % no text on this page
  36.  
  37. /undershow
  38. {   currentlinewidth exch
  39.     dup show   currentpoint 3 2 roll
  40.     stringwidth exch neg exch
  41.     0 -2 rmoveto   rlineto 0.4 setlinewidth stroke
  42.     moveto setlinewidth
  43. } def
  44.  
  45.  
  46. /dolines
  47. {
  48.     gsave
  49.     .1 setlinewidth
  50.     newpath
  51.         .2 inch 5.5 inch moveto
  52.         8.3 inch 5.5 inch lineto
  53.         4.33 inch .2 inch moveto
  54.         4.33 inch 10.8 inch lineto
  55.         stroke
  56.     grestore
  57. } def
  58.  
  59.  
  60. /doFF
  61. {
  62. %
  63. % Takes 2 arguments.
  64. %  Top: type of FF encountered, be it a reall FF, bottom of page,
  65. %       or what-not.
  66. %  Next: force the FF or only if stuff on page.
  67. %
  68.     /curFF exch def
  69.     1 eq
  70.     {
  71.         dolines
  72.         showpage
  73.         /page_text 0 def
  74.     }
  75.     {
  76. %
  77. % if FF right after last line on page, ignore FF
  78. %
  79.         curFF 1 eq                % This is FF?
  80.         lastFF 2 eq                % Last was type 2 -- margin
  81.         x lmarg eq                % Still at left margin
  82.         y tmarg eq                % Still at top margin
  83.         and and and false eq    % Do it if all the above is false
  84.         {
  85.             pg 0 eq
  86.             {
  87.                 /pg 1 def
  88.                 /lmarg lleft def
  89.                 /tmarg btop def
  90.                 /bmarg bbot def
  91.             }
  92.             {
  93.                 pg 1 eq
  94.                 {
  95.                     /pg 2 def
  96.                     /lmarg rleft def
  97.                     /tmarg ttop def
  98.                     /bmarg tbot def
  99.                 }
  100.                 {
  101.                     pg 2 eq
  102.                     {
  103.                         /pg 3 def
  104.                         /lmarg rleft def
  105.                         /tmarg btop def
  106.                         /bmarg bbot def
  107.                     }
  108.                     {
  109.                         dolines
  110.                         showpage
  111.                         /page_text 0 def
  112.                         /pg 0 def
  113.                         /lmarg lleft def
  114.                         /tmarg ttop def
  115.                         /bmarg tbot def
  116.                     } ifelse
  117.                 } ifelse
  118.             } ifelse
  119.         } if
  120.     } ifelse
  121.     /lastFF curFF def
  122.  
  123.     /x lmarg def
  124.     /y tmarg def
  125.     /xw 0 def
  126.     x y moveto
  127. } def
  128.  
  129. /normal-font /Courier findfont 6 scalefont def
  130. /bold-font /Courier-Bold findfont 6 scalefont def
  131. /italic-font /Courier-Oblique findfont 6 scalefont def
  132. /bolditalic-font /Courier-BoldOblique findfont 6 scalefont def
  133. /isbold 0 def
  134. /isitalic 0 def
  135.  
  136. /lineprint
  137. {
  138.     normal-font setfont
  139.     x y moveto
  140.     {i s readline
  141.         {
  142.             x y moveto                % go to start of line
  143.             showline                % show the line on the stack
  144.             /x lmarg def            % reset x to left margin
  145.             /y y lincr sub def        % increment line
  146.             y bmarg lt                % new page if end of page?
  147.             { 0 2 doFF } if
  148.         }
  149.         {
  150.             page_text 1 eq
  151.             {1 0 doFF} if
  152.             exit
  153.         } ifelse
  154.     } loop
  155. } def
  156.  
  157. lineprint
  158.