
On Mon, Mar 10, 2014 at 12:31:30PM +1100, Mark Trickett wrote:
I have a Postscript calendar program which I use to print out a calendar I can put up on a wall for planning purposes. From what I have seen, a clipping box should not "appear", but it does with the following code. For the interested, I can email the main calendar code as well, but not included here for brevity. There are two routines, callmonth and calendar defined prior in the one file. If you have other suggestions, I will read with interest, it is all a learning exercise, but with a practical useful result.
your clip code seems to work ok for me. what is inside the clip boundaries should appear and the rest shouldn't. your margin coordinates setup the clip region to be almost the whole page, so you should be drawing everywhere except a 20pt ~= 0.7cm blank white boundary. that's what happens when I add your clip code as a fn to a .ps file of mine and look at it in evince (+/- evince using Letter for some reason instead of A4). I don't get a line drawn around the clip path. BTW, my postscript is very rusty, but if you previously define a "callmonth" fn then isn't it being overridden by an int (1 to 12) in this line /callmonth exch def ? maybe the rest of the code and a description of what you are trying to achieve would be helpful from here. I'm guessing you're doing a 1 year calendar with each month spread over 2 A4 portrait pages - 24 pages total? I haven't written multi-page PS programs before - are there '%' directives that are needed to make viewers/printers happy? evince just displays the last page of 24 with the simple header I gave your code :-/ ghostscript sees 24 pages though. cheers, robin -- % /l{lineto}def/s{scale}def/m{moveto}def/a{1 arcto 4 2 roll pop pop m}def/c{0 360 arc}def/C{c fill}def/S{stroke}def 10 8 s 10 30 5 c S 21 30 5 c S 12 28 2 C 19 28 2 C 15 22 1 C 1 0.3 s 9 30 4 C 21 30 4 C 1 3.5 s 6 6 1 C 9 6 1 C 12 6 1 C 18 6 1 C 21 6 1 C 24 6 1 C 1 23 m 6 22 l 1 21 m 6 21 l 2 20 m 6 21 l 31 23 m 25 23 l 30 22 m 26 22 l 30 20 m 25 21 l 9 38 m 11 42 l 13 38 l 17 38 m 20 42 l 22 37 l 9 19 m 10 18 10 17 a 11 17 12 18 a 12 18 14 17 a 14 17 16 18 a 16 18 20 18 a 20 18 l 30 15 m 35 17 33 35 43 38 curveto 35 35 38 13 31 12 curveto S showpage
--begin code--
% Set margins and working area
/leftmargin 20 def /botmargin 20 def /pagewidth 555 def /pageheight 802 def
newpath % box for clipping path leftmargin botmargin moveto 0 pageheight rlineto pagewidth 0 rlineto 0 pageheight neg rlineto closepath clip
1 1 12 { /callmonth exch def 0 1 1 { gsave pagewidth mul neg 0 translate 1.95 2 scale callmonth 2014 calendar gsave showpage grestore grestore } for } for
--end code--