cropmarks.ps 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. %
  2. % Center pages, based on pageheight and pagewidth, and redefine showpage
  3. % to put cropmarks at each corner. Device dependent code to expand the
  4. % paper size goes in procedure expandpagesize. Currently only supports
  5. % a Linotronic 200P typesetter using 12 inch wide paper. You'll have to
  6. % add code to expandpagesize to support different typesetters or even a
  7. % 200P that's running differently.
  8. %
  9. /CropmarkDict 40 dict dup begin
  10. /expandpage true def
  11. /magnification 1 def
  12. /pageheight 11.0 def
  13. /pagewidth 8.5 def
  14. /scaletofit false def
  15. /scaling 1 def
  16. /marklength .3 def % inches
  17. /markstart .125 def % inches
  18. /markend .04 def % inches
  19. /marklinewidth .25 def % points
  20. /inch {72 mul} def
  21. /min {2 copy gt {exch} if pop} def
  22. /max {2 copy lt {exch} if pop} def
  23. /setup {
  24. /markspace markstart marklength add markend add inch marklinewidth add def
  25. /totalheight pageheight inch markspace 2 mul add def
  26. /totalwidth pagewidth inch markspace 2 mul add def
  27. pagedimensions
  28. checkpagesize
  29. /scaling getscaling def
  30. xcenter ycenter translate
  31. scaling scaling scale
  32. pagewidth inch 2 div neg pageheight inch 2 div neg translate
  33. clippage
  34. } def
  35. /pagedimensions {
  36. clippath pathbbox newpath
  37. 4 -1 roll exch 4 1 roll 4 copy
  38. sub /width exch def
  39. sub /height exch def
  40. add 2 div /xcenter exch def
  41. add 2 div /ycenter exch def
  42. } def
  43. /checkpagesize {
  44. height totalheight lt width totalwidth lt or expandpage and {
  45. expandpagesize
  46. pagedimensions
  47. } if
  48. } def
  49. /expandpagesize { % device dependent code
  50. /Product statusdict begin /product where {pop product}{()} ifelse end def
  51. Product (Linotype) eq { % Linotronic 200P and other models?
  52. statusdict /setpageparams known {
  53. /maxwidth 12.0 inch def % 12 inch wide paper?
  54. totalheight maxwidth le {
  55. totalheight
  56. totalwidth
  57. maxwidth totalheight sub 2 div
  58. 0
  59. }{
  60. totalwidth maxwidth min
  61. totalheight
  62. maxwidth totalwidth maxwidth min sub 2 div
  63. 1
  64. } ifelse
  65. statusdict /setpageparams get exec
  66. } if
  67. } if
  68. } def
  69. /getscaling {
  70. scaletofit
  71. {height totalheight div width totalwidth div min 1 min}
  72. {1}
  73. ifelse
  74. } def
  75. /clippage {
  76. newpath
  77. 0 0 moveto
  78. pagewidth inch 0 rlineto
  79. 0 pageheight inch rlineto
  80. pagewidth neg inch 0 rlineto
  81. closepath clip
  82. newpath
  83. } def
  84. /cropmark {
  85. gsave
  86. translate
  87. rotate
  88. marklinewidth dup translate
  89. 0 0 transform round exch round exch itransform translate
  90. markstart inch 0 moveto marklength inch 0 rlineto stroke
  91. 0 markstart inch moveto 0 marklength inch rlineto stroke
  92. grestore
  93. } bind def
  94. /@PreviousShowpage /showpage load def
  95. end def
  96. %
  97. % Cropmarks - in the default coordinate system.
  98. %
  99. /showpage {
  100. gsave
  101. CropmarkDict begin
  102. initgraphics
  103. marklinewidth setlinewidth
  104. xcenter ycenter translate
  105. scaling scaling scale
  106. 0 pagewidth inch 2 div pageheight inch 2 div cropmark
  107. 90 pagewidth inch neg 2 div pageheight inch 2 div cropmark
  108. 180 pagewidth inch neg 2 div pageheight inch 2 div neg cropmark
  109. 270 pagewidth inch 2 div pageheight inch 2 div neg cropmark
  110. @PreviousShowpage
  111. end
  112. grestore
  113. } bind def