In theory, any PostScript file can be incorporated into any other, so long as
each obeys certain rules concerning what they are allowed to do to the
`PostScript engine' producing the output. The full collection of these rules
is called the `Adobe Document Structuring Conventions' (DSC) and while the
phrase is widely-used, very little of this document is practically useful for
day-to-day document preparation. The main points to note are:
- %%BoundingBox:
- Does the file to be incorporated have a
%%BoundingBox: comment
somewhere near the top? If not, then one must be calculated. If the
file is printable by itself, then the simplest way to do this is to
print it out, draw around the diagram the smallest rectangle which
contains it, and convert the dimensions of this rectangle to `points'.
For all practical purposes, there are 72 points to the inch, and 2.835
to the millimetre. Bear in mind that the printer's accuracy in
grabbing a piece of paper from the feed tray is only around 1-2mm in
any direction, and try not to become obsessed with accuracy.
All the utilities mentioned above can generate %%BoundingBox:
comments in the right circumstances.
However, PostScript appears on this site from all
sorts of places, and it is wisest not to leave this to
chance-check!
- Diagram origin
- Occasionally, utilities which generate PostScript do so
in `egotistical' fashion, assuming that the user cannot possibly want
anything else on the page with its graphics, and the output is
rotated, scaled and centred on the page. This is all very well, but
what is desirable for inclusion in
is a diagram whose lower-left
%%BoundingBox corner is at the PostSript origin. With most
printers, this means that on printout of the file on its own, the lower
left corner of the diagram will be `off the page' at the bottom left,
because they are designed to believe that they are printing on an
American 8.5''x11'' page, rather than European A4 (210x297mm).
Usually, persuading the file to produce its output at the origin
involves finding the PostScript translate operator responsible
and commenting it out. Then, it may be necessary to `translate' the
%%BoundingBox comment to suit. xfig, xgraph and
MacDraw can all be persuaded to produce `origin graphics';
xpr will need a little strategic commenting.
- Graphics context
- It is perfectly possible for a postScript graphic to
leave the PostScript engine in a state in which it cannot continue, or
to `mess about' with the state so that it is pointless to continue.
The obvious example of this is the showpage operator. If the
file has been produced with a view to printing it out alone, then
somewhere at the tail of the file a showpage will appear, which
to the PostScript engine means `this page description is complete;
print it out'. In the case of a figure in a
document, we would
prefer the rest of the page, after the figure, to be added before that
page is printed. Spurious showpages can be safely commented out.
Complications can also be caused by save/restore and
gsave/grestore appearing in the included file. This is
an area best avoided if possible, where, to use the time-honoured
phrase, `experience and informed courage count for much'. Access to
various PostScript manuals [Adobe85b][Adobe85a] is also
useful here.
xfig, xgraph and
idraw will produce showpageless code;
xpr, again, may need some help.