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.

72 lines
2.1 KiB

1 month ago
  1. % Copyright (C) 2001-2023 Artifex Software, Inc.
  2. % 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. % Refer to licensing information at http://www.artifex.com or contact
  12. % Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
  13. % CA 94129, USA, for further information.
  14. %
  15. % Print a page that indicates the proper settings of Margins and HWMargins
  16. % for a given device. Requires a Level 2 system.
  17. % Reset the offset and margins.
  18. <<
  19. /PageOffset [0 0]
  20. /Margins [0 0]
  21. /.HWMargins [0 0 0 0]
  22. >>
  23. setpagedevice
  24. <<
  25. /ImagingBBox null
  26. >>
  27. setpagedevice
  28. % Determine the actual page size.
  29. clippath pathbbox newpath
  30. /y1 exch def /x1 exch def pop pop
  31. % Draw lines that should be exactly 1" in from each edge,
  32. % and should extend precisely to the edge of the paper.
  33. 1 setlinewidth
  34. 0 setgray
  35. 72 0 moveto 0 y1 rlineto stroke
  36. 0 72 moveto x1 0 rlineto stroke
  37. % Print the text in the middle of the page.
  38. /S 80 string def
  39. 108 480 moveto
  40. /Helvetica 12 selectfont
  41. { currentfile S readline pop dup (%END) eq { pop exit } if
  42. gsave show grestore 0 -15 rmoveto
  43. } loop
  44. Let the distance in inches from the left edge of the page to
  45. the vertical line be H, and from the bottom edge to the
  46. horizontal line be V; let the lengths of the gaps at the top
  47. and bottom of the vertical line be T and B respectively, and
  48. the gaps at the left and right of the horizontal line be L
  49. and R. For correct alignment of pages, put the following line
  50. in a file named (for example) margins.ps, and then mention
  51. margins.ps on the gs command line when printing any of your
  52. own files:
  53. << /.HWMargins [ml mb mr mt] /Margins [x y] >> setpagedevice
  54. where
  55. ml = L * 72, mb = B * 72, mr = R * 72, mt = T * 72,
  56. %END
  57. /res currentpagedevice /HWResolution get def
  58. ( x = (1 - H) * ) show res 0 get =string cvs show
  59. (, y = (V - 1) * ) show res 1 get =string cvs show
  60. showpage