tony@uhcmtg.phys.hawaii.edu (Antonio Querubin) (02/24/91)
I'm looking for some printing filters for PostScript printers (most of the printers are LaserWriters) that will allow me to print plain text files. Are such things available (preferably public domain) and where can I find them? If not, are there any text to PostScript conversion programs out there? Also, does anyone have bare-bones source code for a sample input filter? I may need to do a little hacking to make a Talaris look like a LaserWriter. Thanks in advance! Antonio Querubin
xtdn@levels.sait.edu.au (02/25/91)
tony@uhcmtg.phys.hawaii.edu (Antonio Querubin) writes: > I'm looking for some printing filters for PostScript printers (most of the > printers are LaserWriters) that will allow me to print plain text files. Below is what I used to use (when I had a PS printer). Prepend it to your ascii file and feed it to your PS printer. ----------------------------------------------------------------- % ascii to PS. By David Newall (ccdn@sait.edu.au). % from an original idea by Bevin Steer (ccbjs@sait.edu.au). /cm {28.346457 mul} def % define margins. /topmargin 28.89 cm def /leftmargin 2 cm def /botmargin 0.82 cm def /bufsize 2048 def % read input into this buffer /inputbuf bufsize string def /plainfont (Courier) def /boldfont (Courier-Bold) def /italicfont (Courier-Oblique) def /bolditalicfont (Courier-BoldOblique) def /bold false def /italic false def /fontscale 10 def % = 72/(0.6*12cpi) /linespace 12 def % = 72/lpi /charspace {(0) stringwidth pop} def /newmargins { /topmargin topmargin FBtry fontscale mul sub def /botmargin botmargin FBbly fontscale mul sub def /leftmargin leftmargin FBblx fontscale mul sub def } def /newfont { dup /curfont exch def findfont fontscale scalefont setfont currentfont begin /FontBBox load end cvx exec 1000 div /FBtry exch def 1000 div /FBtrx exch def 1000 div /FBbly exch def 1000 div /FBblx exch def } def % print the page if it has ink on it. leave cursor at top, left corner /printFF { usedpage { copypage erasepage /usedpage false def } if leftmargin topmargin moveto } def % backspace cursor /printBS { currentpoint exch charspace sub dup leftmargin lt {pop leftmargin} if exch moveto } def % move cursor down one line, and to left margin. print page if past % bottom margin /printNL { leftmargin currentpoint linespace sub exch pop dup botmargin lt {pop pop printFF} {moveto} ifelse } def % position cursor to next tab stop /printHT { currentpoint exch charspace 2 div add % allow for rounding error leftmargin sub % horiz offset from leftmargin tabspace div truncate 1 add % => next tab field tabspace mul leftmargin add exch moveto } def % move the cursor to the left margin /printCR { leftmargin currentpoint exch pop moveto } def /BS <08> def /HT <09> def /LF <0A> def /CR <0D> def /FF <0C> def /SP ( ) def % print inputbuf /printbuf { % iteratively prints the buffer by recursively breaking the % input into <text> <control-char> <remainder>; printing <text>; % and performing the action implied by <control-char>. % <input> <control> search => <remainder> <control> <text> true % or <input> false { /stop true def BS search { printbuf pop printBS /stop false def } if HT search { printbuf pop printHT /stop false def } if LF search { printbuf pop printNL /stop false def } if CR search { printbuf pop printCR /stop false def } if FF search { printbuf pop printFF /stop false def } if SP search { printbuf show /stop false def } if stop { exit } if } loop % top of stack is <text> for printing -- no interpretable % control characters here! dup length 0 eq {pop} {show /usedpage true def} ifelse } def /printstdin { /usedpage false def /input (%stdin) (r) file def plainfont newfont newmargins printFF /tabspace 8 charspace mul def { % read a chunk input inputbuf readstring not % exit if EOF {dup length 0 eq {pop exit} if } if % print the buffer printbuf } loop printFF } def printstdin ----------------------------------------------------------------- David Newall, who no longer works Phone: +61 8 344 2008 for SA Institute of Technology E-mail: xtdn@lux.sait.edu.au "Life is uncertain: Eat dessert first"
brachman@cs.ubc.ca (Barry Brachman) (02/26/91)
In article <1991Feb25.002629.1220@athena.mit.edu> jik@athena.mit.edu (Jonathan I. Kamens) writes: > > The "lwf" program in volume 15 of the comp.sources.unix archives will do >what you want. > > I found this out by anonymous ftp'ing to uunet.uu.net, retrieving the files >/comp.sources.unix/index and /comp.sources.misc/index, and searching through >them for the (case insensitive) string "postscript." > >-- >Jonathan Kamens I'd like to point out that the newest version of lwf is available by anonymous ftp to cs.ubc.ca (137.82.8.5) as pub/lwf-2.2.shar.Z. ----- Barry Brachman | UUCP: {alberta,uw-beaver,uunet}!ubc-cs!brachman Dept. of Computer Science| Internet: brachman@cs.ubc.ca Univ. of British Columbia| Vancouver, B.C. V6T 1Z2 | CSNET: brachman@ubc.csnet (604) 228-3123 |