🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #7869

psdraft (was Re: Printing Selected Pages (PSOPT))

#7869
From: Ralph P. Sobek
Date: Wed, 25 Jan 1989 16:31
111 lines
3667 bytes
Concerning my article <276@laas.laas.fr> I received two requests to
repost the psdraft shell script.  It prints diagonally across all
pages of a PostScript(tm) file the user supplied draftstring or
"DRAFT".  Author credits are contained within the script.  I post it,
being a satisfied user.

	--Ralph

Ralph P. Sobek			  Disclaimer: The above ruminations are my own.
ralph@laas.laas.fr			   Addresses are ordered by importance.
ralph@laas.uucp, or ...!uunet!mcvax!laas!ralph		If all else fails, try:
SOBEK@FRMOP11.BITNET				      sobek@eclair.Berkeley.EDU

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	psdraft
# This archive created: Wed Jan 25 17:12:04 1989
export PATH; PATH=/bin:$PATH
echo shar: extracting "'psdraft'" '(1530 characters)'
if test -f 'psdraft'
then
	echo shar: will not over-write existing file "'psdraft'"
else
sed 's/^X//' << \SHAR_EOF > '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#
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 ..."
X	exit
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
SHAR_EOF
if test 1530 -ne "`wc -c < 'psdraft'`"
then
	echo shar: error transmitting "'psdraft'" '(should have been 1530 characters)'
fi
chmod +x 'psdraft'
fi # end of overwriting check
#	End of shell archive
exit 0

-- 
Ralph P. Sobek			  Disclaimer: The above ruminations are my own.
ralph@laas.laas.fr			   Addresses are ordered by importance.
ralph@laas.uucp, or ...!uunet!mcvax!laas!ralph		If all else fails, try:
SOBEK@FRMOP11.BITNET				      sobek@eclair.Berkeley.EDU
Technical Details
Message-ID: <277@laas.laas.fr>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!inria!laas!ralph
References: <3830@pyrdc.UUCP> <276@laas.laas.fr>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!inria!laas!ralph
From: ralph@laas.laas.fr (Ralph P. Sobek)
Newsgroups: comp.lang.postscript
Subject: psdraft (was Re: Printing Selected Pages (PSOPT))
Summary: Received 2 requests to post psdraft
Keywords: psdraft shell script, Unix(tm), transcript
Message-ID: <277@laas.laas.fr>
Date: 25 Jan 89 16:31:19 GMT
References: <3830@pyrdc.UUCP> <276@laas.laas.fr>
Organization: LAAS-CNRS Toulouse France
Lines: 111