You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.7 KiB

1 month ago
  1. %!
  2. % Copyright (C) 2001-2023 Artifex Software, Inc.
  3. % All Rights Reserved.
  4. %
  5. % This software is provided AS-IS with no warranty, either express or
  6. % implied.
  7. %
  8. % This software is distributed under license and may not be copied,
  9. % modified or distributed except as expressly authorized under the terms
  10. % of the license contained in the file LICENSE in this distribution.
  11. %
  12. % Refer to licensing information at http://www.artifex.com or contact
  13. % Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
  14. % CA 94129, USA, for further information.
  15. %
  16. % Add a "caption" to the bottom of each page.
  17. /captionsize 20 def
  18. /caption
  19. { /Helvetica //captionsize selectfont
  20. (Printed by Artifex's XXYYZZ) show
  21. /Symbol //captionsize selectfont
  22. (\324) show % trademarkserif
  23. /Helvetica //captionsize selectfont
  24. ( product) show
  25. } bind def
  26. 10 dict begin
  27. gsave
  28. initgraphics
  29. clippath pathbbox
  30. pop exch 36 add /by exch def
  31. % We can't use stringwidth, so we have to show and measure.
  32. gsave
  33. 0 0 0 0 rectclip
  34. 0 0 moveto caption currentpoint pop /bw exch def
  35. grestore
  36. add bw sub 2 div /bx exch def
  37. % We don't have the font bbox available, so we guess.
  38. /bh captionsize 1.05 mul def
  39. grestore
  40. /showcaption
  41. { gsave
  42. initgraphics
  43. //bx 9 sub //by 9 sub //bw 18 add //bh 18 add
  44. 1 setgray 4 copy rectfill 0 setgray 1.5 setlinewidth rectstroke
  45. //bx //by moveto //caption exec
  46. grestore
  47. } bind def
  48. << /EndPage [
  49. %%
  50. %% Only print the caption if 'reason' is not 2 (device deactivation)
  51. %%
  52. /dup load /exec load 2 /ne load /exec load [ /showcaption load /exec load ] cvx /if load /exec load
  53. currentpagedevice /EndPage get /exec load
  54. ] cvx
  55. >> setpagedevice
  56. end