Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!ub!acsu.buffalo.edu From: cloos@acsu.buffalo.edu (James H. Cloos) Newsgroups: comp.lang.postscript Subject: Psdraft Message-ID: <46353@eerie.acsu.Buffalo.EDU> Date: 14 Nov 90 23:24:00 GMT Sender: news@acsu.Buffalo.EDU Organization: State University of New York @ Buffalo Lines: 134 Nntp-Posting-Host: lictor.acsu.buffalo.edu A while back I posted a small psdraft script that I had expanded. Not only did I manage to shar an old copy of the file, but there was a conceptual error in the postscript, ie showing the grey string over the page, rather than under it. I tried a small change to fix that error, though it does not put up the string on the first page if you use the grey option. Perhaps someone can help out with that problem. Here is the revised psdraft file, in shar format: =--==--===--====--=====--======--=======--======--=====--====--===--==--= #!/bin/sh # This is a shell archive. Remove anything before this line, then # unpack it by saving it in a file and typing "sh file". (Files # unpacked will be owned by you and have default permissions.) # # This archive contains: # psdraft echo x - psdraft sed -e 's/^X//' > "psdraft" << '//E*O*F psdraft//' 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# Augmented to do grey string, choose font by: X# James H. Cloos, Jr. X# currently @ Milard Filmore College X# State University of New York @ Buffalo X# cloos@ACSU.Buffalo.EDU ; cloos@ub.UUCP X# 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 Xdraftstring=DRAFT Xgreylevel=.85 Xdogrey=DRAFTO Xfont=Helvetica-Bold Xdodrafto=DRAFTO Xdodraftg= X Xwhile getopts s:g:f: cc Xdo X case $cc in X s) draftstring=$OPTARG;; X g) greylevel=$OPTARG X dodrafto= X dodraftg=DRAFTG ;; X f) font=$OPTARG;; X \?) echo "Usage: psdraft [-s draftstring] files ..." X exit 2;; X esac Xdone X Xshift `expr $OPTIND - 1` X X# Create sed script file X Xsed -e "s/(DRAFT)/($draftstring)/" \ X-e "s/(GREYLEVEL)/$greylevel/" \ X-e "s/ DODRAFTG / $dodraftg /" \ X-e "s/ DODRAFTO / $dodrafto /" \ X-e "s*/FONT*/$font*" <<'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 /FONT 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/DRAFTO { 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/DRAFTG { gsave\ X initmatrix\ X /FONT findfont setfont (GREYLEVEL) setgray\ 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 DODRAFTO oldshow DODRAFTG end } def\ X/copypage { DRAFTDICT begin DODRAFTO oldcopy DODRAFTG end } def\ X% End of draft prelude X: skip X} XEOF X Xcat $* | sed -f /tmp/psd$$.sed //E*O*F psdraft// echo Possible errors detected by \'wc\' [hopefully none]: temp=/tmp/shar$$ trap "rm -f $temp; exit" 0 1 2 3 15 cat > $temp <<\!!! 96 353 2169 psdraft !!! wc psdraft | sed 's=[^ ]*/==' | diff -b $temp - exit 0 -==--==---==----==-----==------==-------==------==-----==----==---==--==- Enjoy, -JimC -- James H. Cloos, Jr. Phone: +1 716 673-1250 cloos@ACSU.Buffalo.EDU Snail: PersonalZipCode: 14048-0772, USA cloos@ub.UUCP Quote: <>