caption.ps 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. %!
  2. % Copyright (C) 1995 Aladdin Enterprises. All rights reserved.
  3. %
  4. % This software is provided AS-IS with no warranty, either express or
  5. % implied.
  6. %
  7. % This software is distributed under license and may not be copied,
  8. % modified or distributed except as expressly authorized under the terms
  9. % of the license contained in the file LICENSE in this distribution.
  10. %
  11. % For more information about licensing, please refer to
  12. % http://www.ghostscript.com/licensing/. For information on
  13. % commercial licensing, go to http://www.artifex.com/licensing/ or
  14. % contact Artifex Software, Inc., 101 Lucas Valley Road #110,
  15. % San Rafael, CA 94903, U.S.A., +1(415)492-9861.
  16. % $Id: caption.ps,v 1.4 2002/02/21 21:49:28 giles Exp $
  17. % Add a "caption" to the bottom of each page.
  18. /captionsize 20 def
  19. /caption
  20. { /Helvetica //captionsize selectfont
  21. (Printed by Aladdin's XXYYZZ) show
  22. /Symbol //captionsize selectfont
  23. (\324) show % trademarkserif
  24. /Helvetica //captionsize selectfont
  25. ( product) show
  26. } bind def
  27. 10 dict begin
  28. gsave
  29. initgraphics
  30. clippath pathbbox
  31. pop exch 36 add /by exch def
  32. % We can't use stringwidth, so we have to show and measure.
  33. gsave
  34. 0 0 0 0 rectclip
  35. 0 0 moveto caption currentpoint pop /bw exch def
  36. grestore
  37. add bw sub 2 div /bx exch def
  38. % We don't have the font bbox available, so we guess.
  39. /bh captionsize 1.05 mul def
  40. grestore
  41. /showcaption
  42. { gsave
  43. initgraphics
  44. //bx 9 sub //by 9 sub //bw 18 add //bh 18 add
  45. 1 setgray 4 copy rectfill 0 setgray 1.5 setlinewidth rectstroke
  46. //bx //by moveto //caption exec
  47. grestore
  48. } bind def
  49. << /EndPage [
  50. /showcaption load /exec load
  51. currentpagedevice /EndPage get /exec load
  52. ] cvx
  53. >> setpagedevice
  54. end