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 ?
In article <858776157.2177.0@cisay25.demon.co.uk> you wrote:
: Hi.
:
: 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
:
: It is part of the HylaFAX v4.0 fax software and is the user customizable
: part of the email-to-fax gateway.
:
: The gateway inserts the contents of the file above before generating
: the %%EndProlog marker.
:
: I've learnt from the excellent 'First Guide to Postscript' website that
: the "20 20 scale" part is magnifying up the coordinates - the gateway
: generates a "0.5 dup scale" line later on in the file - so the user can
: tweak the size of the image.
:
: 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 ??
Strictly speaking, there are no reserved words in PS, although it is the
better part of valor to be _very_ careful in redefining PS primitives.
Here one procedure begins the EPS file by creating a dictionary with 200
slots for definitions, and then putting it on the top of the dictionary
stack, making it the current dictionary (begin operator). The closing
procedure removes this dictionary from the stack, presumably restoring the
current dictionary for an importing application to the top of the stack
(or userdict if the EPS file is imaged standalone).
The save and restore operators save the state of PS virtual memory (VM)
before the EPS file alters things, and then restore it at the end of the
file. This conserves VM, making it available again for an importing
application, as well as preventing undesired changes to definitions, the
graphics state, etc.
By the way, since a save performs an implicit gsave (saving the graphics
state as one aspect of the VM state), and likewise with restore and
grestore, I'm not sure why the gsave and grestore are required.
:
: I would like to place my own header and footer in the resulting fax
: image, can I achieve this though this code ?
Certainly you could either write your own PS procedure for a header and
footer, or possibly modify the startup and cleanup procedures to add such
elements to your page. It would be easier with applications which actually
let you modify the printer driver to add custom code that automatically
gets printed each time -- but other possibilities (apart from hand-editing
the code each time) include a PS file definiting your own header and
footer which could be merged with the fax file.
:
: Any help, or pointers to further info, greatly appreciated.
:
Please feel free to ask more questions.
: Cheers,
: Phil Watkinson,
: pkw@elgro.co.uk
:
Most respectfully,
Margo
(please remove the extra . from my default return addreess)