Advertisement
Guest User

enscript simple.hdr with added footer

a guest
Oct 3rd, 2016
680
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.58 KB | None | 0 0
  1. %
  2. % Default simple header.
  3. % Copyright (c) 1995 Markku Rossi.
  4. % Author: Markku Rossi <mtr@iki.fi>
  5. %
  6. % Modified: Chris Josefy, USA, MAY 2006
  7. % + Added line wrapping to header to work more like AIX enscript
  8. % + This assumes that one does not change the header font size from the default
  9. % + This also assumes that the line only wraps once
  10.  
  11. %
  12. % This file is part of GNU enscript.
  13. %
  14. % This program is free software; you can redistribute it and/or modify
  15. % it under the terms of the GNU General Public License as published by
  16. % the Free Software Foundation; either version 2, or (at your option)
  17. % any later version.
  18. %
  19. % This program is distributed in the hope that it will be useful,
  20. % but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. % GNU General Public License for more details.
  23. %
  24. % You should have received a copy of the GNU General Public License
  25. % along with this program; see the file COPYING. If not, write to
  26. % the Free Software Foundation, 59 Temple Place - Suite 330,
  27. % Boston, MA 02111-1307, USA.
  28. %
  29.  
  30. % -- code follows this line --
  31. %Format: fmodstr $D{%a %b %d %H:%M:%S %Y}
  32. %Format: pagenumstr $V$%
  33. %HeaderHeight: 44
  34. %FooterHeight: 44
  35.  
  36. /do_header { % print default simple header
  37. gsave
  38. d_header_x d_header_y HFpt_h 3 div add translate
  39.  
  40. HF setfont
  41. user_header_p {
  42. 5 0 moveto user_header_left_str show
  43.  
  44. d_header_w user_header_center_str stringwidth pop sub 2 div
  45. 0 moveto user_header_center_str show
  46.  
  47. d_header_w user_header_right_str stringwidth pop sub 5 sub
  48. 0 moveto user_header_right_str show
  49. } {
  50. fname length fmodstr length add pagenumstr length add 95 6 idiv add d_header_w 6 idiv le{
  51. 5 0 moveto fname show
  52. 45 0 rmoveto fmodstr show
  53. 45 0 rmoveto pagenumstr show
  54. } {
  55. 5 0 moveto fmodstr show
  56. 45 0 rmoveto pagenumstr show
  57. fname length d_header_w 6 idiv idiv 1 add 10 mul 5 exch moveto
  58. 1 1 fname length d_header_w 6 idiv idiv
  59. {
  60. dup fname exch 1 sub d_header_w 6 idiv mul d_header_w 6 idiv getinterval show
  61. 5 exch 10 mul fname length d_header_w 6 idiv idiv 1 add 10 mul exch sub moveto
  62. } for
  63. 5 10 moveto
  64. fname fname length d_header_w 6 idiv idiv d_header_w 6 idiv mul dup fname length exch sub getinterval show
  65. }ifelse
  66. }ifelse
  67.  
  68. grestore
  69.  
  70. gsave
  71. d_footer_x d_footer_y HFpt_h 3 div add translate
  72.  
  73. HF setfont
  74. user_footer_p {
  75. 5 0 moveto user_footer_left_str show
  76.  
  77. d_footer_w user_footer_center_str stringwidth pop sub 2 div
  78. 0 moveto user_footer_center_str show
  79.  
  80. d_footer_w user_footer_right_str stringwidth pop sub 5 sub
  81. 0 moveto user_footer_right_str show
  82. } {
  83. fname length fmodstr length add pagenumstr length add 95 6 idiv add d_footer_w 6 idiv le{
  84. 5 0 moveto fname show
  85. 45 0 rmoveto fmodstr show
  86. 45 0 rmoveto pagenumstr show
  87. } {
  88. 5 0 moveto fmodstr show
  89. 45 0 rmoveto pagenumstr show
  90. fname length d_footer_w 6 idiv idiv 1 add 10 mul 5 exch moveto
  91. 1 1 fname length d_footer_w 6 idiv idiv
  92. {
  93. dup fname exch 1 sub d_footer_w 6 idiv mul d_footer_w 6 idiv getinterval show
  94. 5 exch 10 mul fname length d_footer_w 6 idiv idiv 1 add 10 mul exch sub moveto
  95. } for
  96. 5 10 moveto
  97. fname fname length d_footer_w 6 idiv idiv d_footer_w 6 idiv mul dup fname length exch sub getinterval show
  98. }ifelse
  99. }ifelse
  100.  
  101. grestore
  102. } def
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement