mh@roger.imsd.contel.com (Mike Hoegeman) (01/19/91)
this script "ftops", converts elvis .doc files to postscript. Here is an example refont -f *.doc | ftops > elvisDoc.ps refont comes with the elvis package. ftops conforms enough to structured postscript to make it usable with the X11/NeWS pageview postscript previewer. just snip at cut here line and chmod +x the thing --------------------------------CUT HERE------------------------------ #!/bin/sh if [ X$1 != X ]; then 2>&1 cat <<\EOF ftops is a simple filter, it reads from stdin and writes to stdout it is used for converting files with \f<fontstyle> type font change escapes to postscript. it is a quick hack to convert elvis .doc files to postscript e.g. usage; refont -f *.doc | ftops > elvisDoc.ps EOF exit 1 fi translate () { sed \ -e 's,(,\\\(,g' \ -e 's,),\\\),g' \ -e 's,\\fB,) p B setfont (,g' \ -e 's,\\fI,) p I setfont (,g' \ -e 's,\\fR,) p R setfont (,g' \ -e 's,\\fU,) p U setfont (,g' \ -e 's,^,(,' \ -e 's,$,) ShoW_LinE,' } cat <<\PS_PROLOG %! %%Pages: (atend) %%DocumentFonts Courier Courier-Oblique Courier-BoldOblique %%Title: ftops shell script output %%Creator: ftops %%EndComments /inch { 72 mul } bind def /getfont { exch findfont exch scalefont } bind def /SheetWidth 8.5 inch def /SheetHeight 11 inch def /LeftMargin 20 def /TopMargin 20 def /bodyfontsize 12 def /bodyfont /Courier bodyfontsize getfont def /R bodyfont def /B /Courier-Bold bodyfontsize getfont def /I /Courier-Oblique bodyfontsize getfont def /U /Courier-BoldOblique bodyfontsize getfont def /startpage { LeftMargin SheetHeight TopMargin sub moveto R setfont } def /endpage { showpage } def % Function s: print a source line /s { gsave show grestore currentpoint exch pop LeftMargin exch bodyfontsize sub moveto } def /p { show } def /ShoW_LinE { s } def %%EndProlog PS_PROLOG translate | awk 'BEGIN { lines=0 maxlines=66 pages=1 } { #MAIN if ($NF~/ShoW_LinE/) { ++lines } if (lines==1) { printf("%%%%Page: %d %d\n", pages, pages) printf("startpage\n") } print if (lines == maxlines) { ++pages printf("endpage\n") lines=0 } } END { printf("%%%%Trailer\n") printf("%%%%Pages: %d\n", pages) } ' - exit 0