From: ib@ivan.asd.sgi.com (Ivan Bach)
Newsgroups: comp.sys.sgi.misc
Subject: Re: Tool to convert POSTSCRIPT to EPS
Keywords: PostScript, Encapsulated PostScript, converting, tools
Date: 24 Dec 92 21:38:36 GMT
Organization: Silicon Graphics, Inc., Mountain View, CA

Articles about several tools for the conversion of PS to EPS files were
posted to the newsgroup comp.lang.postscript.  For example, you can get a 
compressed tar file called pub/ps2eps.tar.Z from duteela.et.tudelft.nl 
(130.161.144.18) by anonymous ftp.  Use the bin file transfer mode.  

I'll send you a few scripts that can be used to convert a PS file to an EPS 
or EPSI (Encapsulated PostScript Interchange) file. 

You should check whether the program which generated your PS files can
generate EPS files.  Look for an EPS or EPSF option in the menu for 'Save As'
or in the print dialog box.  If there is such an option and you have 
original documents, use them to produce EPS files, instead of PS files.

You should read Appendix H.2 ("Guidelines for Creating EPS Files") on pp.
712-718 in the Adobe PostScript Language Reference Manual, Second Edition
(ISBN 0-201-18127-4).  Appendix H in that book describes the Version 3.0 of
the Encapsulated PostScript file format.  You can get descriptions of previous
versions of EPS from the Adobe PS file server.  Send the e-mail message:

    Subject: help

to ps-file-server@adobe.com to find out how to use that server.

A PS file may describe images on more than one page.  Look for comment
statements that start with %%Pages and %%Page, and the PostScript operator
'showpage.'  An EPS file should describe the appearance of a single page.
You should produce an EPS file for each page specified in your PS file.
If your PS file contains a prolog (look for %%EndProlog), then you should
include that prolog at the beginning of each EPS file.

If the first line in your EPS file starts with %!, replace it with a DSC
(Document Structuring Conventions) header comment statement such as:

    %!PS-Adobe-3.0 EPSF-3.0

If the first line does not start with %!, use a statement like the one shown
above as the first line in your EPS file.  Remove those types of DSC
statements which should not appear in a Version 3.0 EPS file (see the
guidelines for creating EPS files).  If you are not sure which DSC statements
should be removed, remove all lines that start with %%, and then put a DSC
bounding-box header comment statement such as:

    %%BoundingBox: llx lly urx ury

after the line that starts with %!.  The entries llx and lly stand for the x
and y coordinates of the lower-left corner of a bounding box for the image
described by EPS code, while urx and ury stand for the x and y coordinates of
the right-upper corner of that bounding box.  I posted an article about how
to determine the coordinates of a bounding box of an EPS image (see also p.
713 in the PS Language Ref. Manual).  Since the coordinates of a bounding
box are usually specified in points, the bounding-box statement should look
something like:

    %%BoundingBox: 21 31 527 537

As explained on p. 714 of the PS Language Ref. Manual, some PostScript
operators must not be used in an EPS file.  If your PS file contains such
operators, you should eliminate them.

The two DSC statements shown above are the only DSC header statements required
in an EPS file.  When you specify them, try to use the EPS file you created.

If you want to import an EPS file into a program, check whether the manual
for that program specifies any restrictions for the importing of EPS files.
For example, some programs accept only EPS files that start with:

    %!PS-Adobe-2.0 EPSF-1.2

You should look at some sample EPS files which can be imported into that
program, and then use the same format for your EPS files.

Ivan Bach, ib@sgi.com