From: dshaker@qualix.com (Doug Shaker)
Subject: Re: PS to EPS convert??
Reply-To: dshaker@qualix.com
Organization: QUALiX Group, Inc.
Date: Thu, 5 Nov 1992 21:11:07 GMT

In article 3pn@ecf.toronto.edu, ajmani@ecf.toronto.edu (AJMANI KEITH SANJAY) writes:
>	A quick question. I don't know if such aprogram exists,
>but if anyone know of one that converts postscript files to 
>encapsulated postscript, I would greatly appreciate any such info.
>	I need this because I printed from GNUplot as .ps and
>want to read the file into Corel, which only accepts .eps (and the same
>with WFW)
>
> 	Merci. Mail me at :
>
>		ajmani@skule.ecf.toronto.edu
>
>Thanx.
>
>-- 
>		     [][][][][][][][][][][][][]
>##----##--##-##-##----#########--[]--------###-----(Eng. Sci. sux and blows
>####--##--##-##-##----##-----##--[]------##-##----  dead bears, doo dah,
>##-##-##----####------#########--[]----##---##---   doo dah.....)


Here is an article from the Qualix Group customer newsletter that tells how to
do what you need to know:


 - Doug Shaker
	voice:	415/572-0200
	fax:	415/572-1300
	email:	dshaker@qualix.com
	mail:	Qualix Group
		1900 S. Norfolk St., #224
		San Mateo, CA 94403

Qualix maintains a mailserver with information files and demo
versions of products.  If you would like more information on
the mailserver, send an email to qfacts@qualix.com (or 
uunet!qualix!qfacts).  The email should contain just two lines:
	send help
	send index

-------------Postscript(R) to Encapsulated Postscript in One Easy Lie.

Here's the problem - you are slaving away at your latest report for
your boss.  Suddenly it hits you - you can avoid five pages of tortured
explanation if you can just find a way to include a chart from that
nifty graphic application package you got four months ago.  It
generates Postscript(R), your word processor accepts Postscript -
everything should be hunky-dory - right?  But when you go to import the
graphic into your report, you see that it wants Encapsulated Postscript
(EPSI), not regular Postscript.  You feed it the regular Postscript
output from your application program and it barfs it back out again.
Now it's ten minutes until your meeting with the big boss and you can't
possibly write the five pages in time.  What do you do?

It`s a common enough problem.  Most Unix applications can generate
Postscript output, but they generate regular Postscript, not
encapsulated Postscript.  Most word processors can import graphics
files and display them as figures, but they need Encapsulated
Postscript, not just regular Postscript.  Getting from one to the other
can seem impossible.  But we're going to teach you how to lie to your
word porcessor and make everything work.

First, let's define a few terms.  Postscript is a page description
language, invented at Xerox PARC and commercialized by Adobe Systems,
Inc.  Postscript programs literally describe pages.  A Postscript
program (or file - same difference) lets a Postscript compatible
printer know, in excruciating detail, what a page of output should look
like.  It consists of statements that say, in effect, "Center that
title one inch down from the top of the page and put it in Times
Roman."

So what is Encapsulted Postscript?  Well, in ordinary Postscript, it is
possible to make a senseless statement like "Center that title one inch
above the top of the page" and all that will happen is that the printer
will not print it. After all, there isn't any paper one above the top
of the page so the printer can't very well put ink up there.  However,
in Encapsulated Postscript, the Postscript program makes the promise
never to mark outside the page.  That way a word processing program can
import the graphic and know that it will stay inside the figure box (or
whatever) that it has drawn around it.  Otherwise Encapsulated
Postscript is exactly the same as Postscript - it's just Postscript
plus a promise.

However, it's a promise that is hard to make.  If an application
programmer (the person who wrote your nifty graphics application
program) is going to make the Encapsulated promise, he or she needs to
spend LOTS of time looking over their code making sure that they will
never draw outside the "bounding box".  Most programmers hate doing
work like that and users hardly ever mention, in their feature
requests, "generate Encapsulated Postscript".  So it hardly ever gets
done.

So, how can we get it done in time for your meeting?  Well, we cheat.
We lie to the word processor program.  We make the promise that we will
stay inside the bounding box and then just hope it is true.  If it
isn't true, the word processor may crash when it tries to print.  If it
turns out to be true (and it almost always is true) then the report
comes out and looks great.

Here is how to lie to your word processor.   The top of a regular
postscript file looks like this:

	%!PS-Adobe-2.0
	%%Creator: NiftyZap
	%%Title: Resource Histogram
	%%CreationDate: 
	%%Pages: (atend)
	%%BoundingBox: 36.000 36.000 720.000 540.000
	%%EndComments

and the top of an Encapsulated Postscript file looks like this:

	%!PS-Adobe-2.0 EPSF-1.0
	%%Creator: NiftyZap
	%%Title: Resource Histogram
	%%CreationDate: 
	%%Pages: (atend)
	%%BoundingBox: 36 36 720 540
	%%EndComments

To make the file change from an honest, clean-living, Postscript file
to a shifty low-lige of a file that claims it is Encapsulated Postcript
even though it isn't really, all you need to do is
	1) make a backup of your postscript output,
	2) open your postscript file in a text editor,
	3) add the characters "EPSF-1.0" to the end of the first line,
	4) if necessary, change the bounding box numbers to integers from
		floating point,
and	5) write out your file.
Now go back to your word processor and try importing the file as an
Encapsulated Postscript file.  Ninety-nine times out of a hundred, it
works fine.