paul@dana.UUCP (Paul Ausick) (04/17/87)
We use a Sun3 network with their 3.0 OS and Adobe's Transcript, without ditroff, hooked to Apple/Sun LW+. Here's the question: I want to print the word "DRAFT" on every page of a document in outline letters right across the middle of the page, slanting upwards. I have written a little sed script that filters the output of pscat before sending the output to lpr. Here's the sed file: /^BP$/a\ save /savePSCAT exch def /Helvetica-Bold findfont 288 scalefont setfont 244 244 moveto %coordinates print text approx. .5" down and .5" in from %upper right corner of page - these can be changed gsave 30 rotate (DRAFT) true charpath gsave 1 setgray fill grestore stroke grestore savePSCAT restore Believe it or not this almost works. The big problem is that the y-axix is inverted. The PS "30 rotate" rotates the output clockwise, not counterclockwise as it should. And the text is printed as if were hinged on the baseline and the hinge were opened. Hold a piece of printed text upside down and look through the back of the page. That's what I get. I can get the PS program to work on its own; of course I have to change the coordinates. I'm sure the /BP in the pscat.pro file is what's causing this, but I want to work around, not change, that if I can. Can anyone help? What is happening? How can I fix it? Thanks, /Paul Ausick ...hplabs!dana!paul
thomas%spline.uucp@utah-gr.UUCP (Spencer W. Thomas) (04/21/87)
In article <148@dana.UUCP> paul@dana.UUCP (Paul Ausick) writes: >I want to print the word "DRAFT" on every page of a document >in outline letters right across the middle of the page, slanting >upwards. I've got just the thing for you. This shell script is run as a filter and redefines the "showpage" and "copypage" operators to print the word "DRAFT" (by default) or whatever word you want as outlined characters diagonally across the page. Thus, you might say psdraft file.ps | lpr To get it to read stdin, use - as the file name: dvi2ps file.dvi | psdraft - | lpr I have tested it with output from Scribe, TeX and ditroff. =Spencer ({ihnp4,decvax}!utah-cs!thomas, thomas@cs.utah.edu) -------------------------------- Cut Here -------------------------------- #! /bin/sh sed 's/^X//' <<'EOF' X#! /bin/sh X# X# Put the word "DRAFT" (or a specified word) on each page of a postscript X# document. X# X# Usage: X# psdraft -s draftstring file ... X# X# X# Author: Spencer W. Thomas X# Computer Science Dept. X# University of Utah X# thomas@cs.utah.edu X X# X# Insert header after first line that does not begin %% or %! X# X Xtrap "rm -f /tmp/psd$$.*" 0 1 2 15 X Xif [ "x$1" = "x-s" ] ; then X draftstring=$2 X shift X shift Xelse X draftstring=DRAFT Xfi X Xif [ "x$*" = "x" ] ; then X echo "Usage: psdraft [-s draftstring] files ..." Xfi X X# Create sed script file X Xsed "s/(DRAFT)/($draftstring)/" <<'EOF' >/tmp/psd$$.sed X1,/^[^%]/{ Xs/^%/%/ Xs/^$// Xt skip Xi\ X% Prelude to show a draft string on every page.\ X(DRAFT)\ X/DRAFTDICT 10 dict def\ XDRAFTDICT begin\ X/DRAFTSTRING exch def\ X/bd /Helvetica-Bold findfont def\ X/od bd maxlength 1 add dict def\ Xbd {exch dup /FID ne {exch od 3 1 roll put} {pop pop} ifelse} forall\ Xod /FontName /Outline0 put od /PaintType 2 put od /StrokeWidth 0 put\ X/Outline0 od definefont pop\ X/DRAFT { gsave\ X initmatrix\ X /Outline0 findfont setfont\ X DRAFTSTRING dup stringwidth pop 8.875 exch div dup 72 mul dup scale\ X 52.3 rotate 2.5 exch div -.35 translate\ X 0 0 moveto show\ X grestore } def\ X/oldshow /showpage load def\ X/oldcopy /copypage load def\ Xend\ X/showpage { DRAFTDICT begin DRAFT oldshow end } def\ X/copypage { DRAFTDICT begin DRAFT oldcopy end } def\ X% End of draft prelude X: skip X} XEOF X Xcat $* | sed -f /tmp/psd$$.sed EOF exit 0 =Spencer ({ihnp4,decvax}!utah-cs!thomas, thomas@cs.utah.edu)