Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Misbehaved EPS

Status
Not open for further replies.

svmarti

Programmer
Joined
Apr 5, 2004
Messages
6
Location
NO
I have tried to embed EPS-files into my own Postscript and get from time to time error when trying to wrap the EPS with save/restore

It seems that the EPS somehow makes my restore crash.
Without save/restore pair around the EPS it seems to work fine, but as i try to make an C-program that should be able to include "any" EPS into a PS file i would like to know if there is any technique to save/restore the graphic context without any EPS-file beeing able to "destruoy" my restore.

I have not analyzed the huge EPS thorougly but i have two guesses of what might be wrong:
- restore beeing somehow redefined
- stack left unbalanced.

Is there a way to make sure that
"restore" still is the "original" restore
and that the EPS does not litter the stack with left-over objects.

I guess this is basic PS i should know, but i am no proficient PS programmer.
Also i HAVE studied other articles on preparing EPS-files (removing binary bytes before !PS and so on).

Kind regards from Oslo-Norway
 
Here are the procedures I use for "EPS housekeeping":

Code:
/StartEPSF
  { userdict begin
      /PreEPS_state save def
      /dict_stack countdictstack def
      /ops_count count 1 sub def
      /setpagedevice /pop load def
      /showpage {} def
  } bind def
  
/EndEPSF
  {   count ops_count sub {pop} repeat
      countdictstack dict_stack sub {end} repeat
      PreEPS_state restore
    end  % userdict
  } bind def

Call "StartEPSF" before you include or "run" an EPS. Call "EndEPSF" afterwards.



Thomas D. Greer

Providing PostScript & PDF
Training, Development & Consulting
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top