xref: /plan9/sys/src/cmd/postscript/cropmarks/cropmarks.rc (revision 219b2ee8daee37f4aad58d63f21287faa8e4ffdc)
1#!/bin/rc
2# Center pages and put cropmarks at each corner. Physical page size
3# is set with -w and -h. The default is 8.5 by 11.0 inches. Device
4# dependent code to change paper size (e.g. with setpageparams) goes
5# in the prologue. You may need to customize the device dependent
6# code that we distribute. By default it only supports variable page
7# sizes on Linotronic typesetters, and assumes those typesetters are
8# using 12 inch wide paper. Use -d to disable execution of device
9# dependent PostScript code.
10#
11# What's here was written quickly and will likely be very different
12# in our next release. It should be part of a more general program!!
13#
14
15POSTLIB=/sys/lib/postscript/prologues
16PROLOGUE=$POSTLIB/cropmarks.ps
17
18EXPANDPAGE=true
19PAGEWIDTH=8.5
20PAGEHEIGHT=11.0
21SCALETOFIT=false
22XOFFSET=0.0
23YOFFSET=0.0
24
25NONCONFORMING=%!PS
26ENDPROLOG=%%EndProlog
27BEGINSETUP=%%BeginSetup
28ENDSETUP=%%EndSetup
29
30while (! ~ $#* 0 && ~ $1 -*) {
31	switch ($1) {
32	case -d;  EXPANDPAGE=false
33
34	case -h;  shift; PAGEHEIGHT=$1
35	case -h*; PAGEHEIGHT=`{echo $1 | sed s/-h//}
36
37	case -s;  SCALETOFIT=true
38
39	case -w;  shift; PAGEWIDTH=$1
40	case -w*; PAGEWIDTH=`{echo $1 | sed s/-w//}
41
42	case -x;  shift; XOFFSET=$1
43	case -x*; XOFFSET=`{echo $1 | sed s/-x//}
44
45	case -y;  shift; YOFFSET=$1
46	case -y*; YOFFSET=`{echo $1 | sed s/-y//}
47
48	case -L;  shift; PROLOGUE=$1
49	case -L*; PROLOGUE=`{echo $1 | sed s/-L//}
50
51	case --;
52
53	case -*;  echo '$0: illegal option $1' >[1=2]; exit 1
54
55	}
56	shift
57}
58
59echo $NONCONFORMING
60cat $PROLOGUE
61echo $ENDPROLOG
62echo $BEGINSETUP
63echo 'CropmarkDict begin'
64echo '/pageheight '$PAGEHEIGHT' def'
65echo '/pagewidth '$PAGEWIDTH' def'
66echo '/expandpage '$EXPANDPAGE' def'
67echo '/scaletofit '$SCALETOFIT' def'
68echo '/xoffset '$XOFFSET' def'
69echo '/yoffset '$YOFFSET' def'
70echo 'setup'
71echo 'end'
72echo $ENDSETUP
73
74cat $*
75