🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #8921

Re: need *simple* way to print ascii files on laserwriter

#8921
From: Ben Cranston
Date: Thu, 08 Feb 1990 19:13
59 lines
2412 bytes
%!-Adobe-1.0
%%Title: asciiprint.ps
%%Creator: Ben Cranston <zben@umd2.umd.edu>
%%CreationDate: Thu Feb 8 1990
%%Pages 0

/Courier findfont 10 scalefont setfont
/colwid (m) stringwidth pop def
36 756 moveto
256 string
{ %exec
   { %loop over file
      dup currentfile exch readstring exch
      { %loop FF
         (\f) search exch
         { %loop LF
            (\n) search exch
            { %loop CR
               (\r) search exch
               { %loop TAB
                  (\t) search exch
                  { %loop BS
                     (\b) search exch
                     show
                     not { exit } if
                     pop currentpoint exch colwid sub exch moveto
                  } loop %BS
                  not { exit } if
                  pop currentpoint exch 36 sub colwid div .49 add cvi
                  8 add dup 8 mod sub colwid mul 36 add exch moveto
               } loop %TAB
               not { exit } if
               pop 36 currentpoint exch pop moveto
            } loop %CR
            not { exit } if
            pop 36 currentpoint exch pop
            11 sub dup 25 le { %if
               pop showpage 756
            } if
            moveto
         } loop %LF
         not { exit } if
         pop showpage 36 756 moveto
      } loop %FF
      not { exit } if
   } loop %over file
   pop showpage
} bind exec

The tab code has been changed to make it more readable and modifiable.
The two 8s are the tab stops, you should be able to change them to any
other number.  The only other change is the indentation at three should
be a tad more readable than the old indentation at two.

-- 
Sig     DS.L    ('ZBen')       ; Ben Cranston <zben@Trantor.UMD.EDU>
* Network Infrastructures Group, Computer Science Center
* University of Maryland at College Park
* of Ulm
Technical Details
Message-ID: <6103@umd5.umd.edu>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!snorkelwacker!apple!brutus.cs.uiuc.edu!uakari.primate.wisc.edu!aplcen!haven!umd5!zben
References: <1990Feb2.220910.16236@umn-cs.cs.umn.edu> <17862@rpp386.cactus.org>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!snorkelwacker!apple!brutus.cs.uiuc.edu!uakari.primate.wisc.edu!aplcen!haven!umd5!zben
From: zben@umd5.umd.edu (Ben Cranston)
Newsgroups: comp.lang.postscript
Subject: Re: need *simple* way to print ascii files on laserwriter
Summary: better tab code
Message-ID: <6103@umd5.umd.edu>
Date: 8 Feb 90 19:13:59 GMT
References: <1990Feb2.220910.16236@umn-cs.cs.umn.edu> <17862@rpp386.cactus.org>
Reply-To: zben@umd5.umd.edu (Ben Cranston)
Organization: University of Maryland, College Park
Lines: 59