I believe that, if you want footers, you have to write a custom hdr file and then select it with the --fancy-header
option. I have written one (below) that may work for you.
There is a nine-year-old bug report on this problem. The approach in that bug report attempts a more comprehensive solution and requires re-compiling enscript
. My approach is not as comprehensive but eliminates the need for a re-compile.
This header file is based on simple.hdr
. To use it, copy and paste it into a file called, say, simple2.hdr
, and, for system-wide use, place it in the directory /usr/share/enscript
. For personal use, it can be placed in the ~/.enscript/
directory:
% -- code follows this line --
%Format: fmodstr $D{%a %b %d %H:%M:%S %Y}
%Format: pagenumstr $V$%
%HeaderHeight: 38
%FooterHeight: 15
/do_header { % print default simple header
% Footer
gsave
d_footer_x d_footer_y HFpt_h 3 div add translate
HF setfont
user_footer_p {
d_footer_x d_footer_y moveto user_footer_left_str show
d_footer_w user_footer_center_str stringwidth pop sub 2 div
0 moveto user_footer_center_str show
d_footer_x d_footer_w add user_footer_right_str stringwidth pop sub
d_footer_y moveto user_footer_right_str show
} if
grestore
% Header
gsave
d_header_x d_header_y HFpt_h 3 div add translate
HF setfont
user_header_p {
5 0 moveto user_header_left_str show
d_header_w user_header_center_str stringwidth pop sub 2 div
0 moveto user_header_center_str show
d_header_w user_header_right_str stringwidth pop sub 5 sub
0 moveto user_header_right_str show
} {
5 0 moveto fname show
45 0 rmoveto fmodstr show
45 0 rmoveto pagenumstr show
} ifelse
grestore
} def
Usage is quite simple. You can then invoke it with something like:
enscript --fancy-header=simple2 --header="HEADER" --footer="LEFT|CTR|RIGHT"
Note that, although enscript
supports many character sets, it does not support UTF-8. Files that are not in a natively supported character set can be filtered through iconv
first before passing them to enscript
.