Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Insert EPS image into PostScript document

For inserting an external EPS file into a PostScript document, it is instructed to open the EPS file with text editor and copy/paste the text-based data within the PostScript file.

I wonder if there is a standard approach to include the external EPS file inside the PostScript document? I mean linking to the EPS file, as PS can catch and read its content when running the PostScript document. I've read something about run command, but have no idea how to use it for including external EPS file within main PostScript document.

UPDATE: When inserting the EPS image as

%!PS-Adobe-3.0

/Times-Roman findfont
14 scalefont setfont

72 700 moveto
(Thi is a text) show

72 300 translate
(1.eps)run

72 100 moveto
(Another text bellow image) show
showpage

it sends to the next page. In this example, the second text goes to page 2, instead of displaying at position )72 100.

like image 357
Googlebot Avatar asked Dec 20 '22 16:12

Googlebot


1 Answers

Since you expanded your original question, I better add another answer...

First, don't use %!PS-Adobe-3.0 in the first line (it says your file is conforming to a certain standard, which it does not do). Use just %!PS (or even just %!).

Second, you'll have to make sure that your 1.eps file is indeed a valid EPS. Since you do not include your 1.eps, I cannot check this.

Third, no it isn't the translate statement that causes the new page to be created -- this translate per se is syntactically OK (depending on which effect you want to achieve).

Fourth, your EPS should not use the showpage operator, otherwise that simple line given in my other answer will not work on its own. In case the EPS itself ejects a showpage you need to re-define the showpage operator to a no-op before you run the EPS, and restore the original showpage semantics after the run:

save
/showpage {} bind def
(my.eps) run
restore

Fifth, the second text does not necessarily appear below the EPS. Depending on the actual size of the EPS, it may well appear to be printed across the EPS' space.

Sixth, the first text may be covered by the EPS' strokes and fills (depending on the actual drawing size of the EPS) and may hence appear not to be there at all.

Seventh, real PostScript gurus (I'm not one), may find a Zeroth, Eighth, Nineth, Tenth and even moreth item to point out regarding this topic... ;-)

like image 193
Kurt Pfeifle Avatar answered Dec 28 '22 07:12

Kurt Pfeifle