HylaFAX The world's
most advanced open source fax server
|
|
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
Re: What does this PS code mean ?
pkw@elgro.co.uk (Phil Watkinson) wrote:
>Please could someone tell me what's happening in the following
>postscript code :-
>
> % faxmail prologue file.
> %
> /EPSbegin{save gsave 20 20 scale 200 dict begin}def
> /EPSend{end grestore restore}def
>The Guide also implies that '/EPSbegin' and '/EPSend' are procedures,
>but I can't see where they are used... and the procedures names cannot
>be 'begin' and 'end' because they are reserved words, aren't they ??
The /EPSbegin definition will be called a little later in the file,
normally in the %%Setup section. The existing defaults will be 'saved' and
the new scaling isolated by 'gsave'. The faxdict is the 'currentdict' with
200 entries which is placed on top of the stack.
'EPSend' will be called at the end of the file, probably in the %%Trailer,
and 'end' removes the dictionary, 'grestore' removes the scaling and
'restore' puts things back as they were before 'EPSbegin was called.
You cannot redefine 'begin'and 'end' but you can add them to make a new
name of your own as happens here.
>I would like to place my own header and footer in the resulting fax
>image, can I achieve this though this code ?
Yes, make your own defs in the Prolog and insert them into the above
commands, presumably just before 'scale' or the typeface will be 20 times
too large!
/header {
0 0 moveto
/Times-Roman findfont 10 scalefont setfont
(This is my header) show
}def
/footer {
0 0 moveto
/Times-Roman findfont 10 scalefont setfont
(This is my footer) show
}def
insert: --
gsave % to isolate your following translation %
80 720 translate % top of A4 %
header
grestore
gsave
80 80 translate % bottom of A4
footer
grestore
It is always preferable to construct the header and footer in the bottom
left hand corner with '0 0 moveto' and then 'translate' them where you
want. This lets you move them where you want rather than setting them in
concrete at (say) 100 600 moveto.