lee@sq.sq.com (Liam R. E. Quin) (12/15/89)
Yet another ascii...postscript program? Yawn.... Why is it different? (you can use this on non-postscript printers too, with a few minutes of enjoyable hacking...) Well, this one gets about 150 lnes on most 11x8.5" pages, and about 150 lines on A4 pages. Most pages? Well, it uses two columns... or more if more will fit... or less if they won't. So /usr/dict/words will go in lots of tiny columns and news articles generally won't. You need: * pfm (see the immediately preceding article from this site) <1989Dec15.055304.21116@sq.sq.com> [spot the Toronto C-news site :-)] * nawk -- from the AT&T toolchest or from MKS or free with System V [:-)] You might also want: * fold -- free from the BSD Tahoe tape * cat -v [warning -- this is harmful :-)] or vis * a postscript printer [:-)] I call it Lpslp100, but that is a silly name, so you should call it Andrew. or Polly. Or.... No man page, this is alt.sources :-( You might want to change the numbers near the top and the last line. Lee #! /bin/sh : use /bin/sh # Turn ascii files into PostScript # Liam Russell Quin; Copyright Unixsys UK Ltd, 1987, 1989; # All rights reserved # Version for smaller size -- be warned that it takes a little while to # print the first page... # ensure that PATH contains /u/lee/bin. where pfm lives # CHANGEME PFMBIN=/u/lee/bin PFM=${PFMBIN}/pfm export PFM SIZE= COLS=178 # the (approx) number of columns you get on a page of paper (A4) LINES=83 # the (approx) number of lines per page you get # INNERLINES=`expr $OUTERLINES - 5` # take pr header into account # First, the PostScript preamble. This keeps a count of the lines # on the page, so it can be the same as pr's count. # ( cat << TERMINUS %!PS-Adobe-1.0 %%Creation-date `date` /textfont /Courier def /textsize 7.2 def /vspace 7.2 def /inch {72 mul} def % Landscape Mode: /pagelength 8.5 inch cvi def /pagewidth 11 inch def % portrait mode, but you have to change the numbers % /pagelength 11 inch vspace 2 mul add def % need to tweak this for individual printers (ugh) /topmargin 0.15 inch def /leftmargin 0.2 inch def /newpage { 90 neg rotate pagewidth neg 0 translate % pagewidth % pagex pagey translate % 180 rotate /vpos pagelength topmargin sub def /linessofar 0 def } def /endpage { showpage } def /L { % show a line /vpos vpos vspace sub def /linessofar linessofar 1 add def linessofar $LINES ge { endpage newpage } if leftmargin vpos moveto show } def /LL { % Last Line L endpage } def /Begin { % set things up /FT textfont findfont def } def /NewFile { FT textsize scalefont setfont newpage } def TERMINUS if [ $# = 0 ] then set - - fi echo Begin if [ $# = 0 ] then set -- - fi # pr ${PROPTS} -l${OUTERLINES} -w${COLS} - "$i" | echo NewFile $PFM -p 'cat -v %f' -n -l${LINES} -w${COLS} -d -Hl "%s: `date` Page %P" \ -Hr "%s %l...%n %e" ${@+"$@"} | sed -e 's/[()\\]/\\&/g s/ *$//g s/^.*$/(&)L/ $s/L$/LL/' ) | nawk ' # delete blank lines at the end of input (buggy pr?) /^\([ ]*\)L$/ { ++LineCount; next } /^[ ]*\([ ]*\)LL$/ { print "endpage"; LineCount = 0; next } { for (i = 0; i < LineCount; i++) printf "()L\n" LineCount = 0 print } ' # | lpr -P${PRINTER-alw} exit 0 # in case they want to leave my .signature here... # end of Lpslp100 -- Liam R. Quin, lee@sq.com Until Dec. 20th (visiting sq, not an employee) After Dec 20, Unixsys (UK) Ltd, Knutsford, UK -- +44 565 50021 At home: +44 925 831084 (0830 GMT to midnight GMT only please...) rn: .signature: cannot open: no such fire or dirigible