www.eamoncaddigan.net

Content and configuration for https://www.eamoncaddigan.net
git clone https://git.eamoncaddigan.net/www.eamoncaddigan.net.git
Log | Files | Refs | Submodules | README

threehole.ps (1218B)


      1 %!PS
      2 % Adjust these to suit your needs, units are specified in "points" (1/72 inch)
      3 /w 612 def /h 792 def       % US Letter paper
      4 /st 1 72 mul 300 div def    % Stroke width (1 'dots' in 300 dpi resolution)
      5 /co 0.0 def                 % Grey-level of the line (0 = black, 1 = white)
      6 /r 72 8 div def             % Hole circle radius (1/4" diameter hers)
      7 /l 72 5 div 2 mul def       % Length of crosshair segment
      8 /o l -2 div def             % Crosshair offsets
      9 
     10 % Draw a circle with crosshairs (x y -- )
     11 /c {
     12   2 copy
     13   moveto
     14   o 0 rmoveto
     15   l 0 rlineto
     16   o o rmoveto
     17   0 l rlineto
     18   stroke
     19   newpath r 0 360 arc closepath stroke
     20 } def
     21 
     22 % Draw three holes at the given x-offset (x -- )
     23 /d {
     24   h 2 div               % y offset of the center hole
     25   108 72 mul 25.4 div   % distance from center hole (108 mm)
     26   3 copy add c          % Top hole
     27   3 copy sub c          % Bottom hole
     28   pop c                 % Center hole
     29 } def
     30 
     31 3 72 mul 8 div dup      % Push the edge offset onto the stack (twice)
     32 
     33 % Draw the left hole punch page
     34 << /PageSize [w h] >> setpagedevice
     35 co setgray
     36 st setlinewidth
     37 d
     38 showpage
     39 
     40 % Draw the right hole punch page
     41 << /PageSize [w h] >> setpagedevice
     42 co setgray
     43 st setlinewidth
     44 w exch sub d
     45 showpage