samurai@cs.mcgill.ca (Darcy BROCKBANK) (06/20/91)
In article <1991Jun20.050319.22444@ux1.cso.uiuc.edu> J-Beauchamp@uiuc.edu writes: > >I would like to be able to paste individual graphs into WriteNow. Is there a >way to accomplish this in general? I suspect that I need the .eps format to >do this. Is there a way to convert a .ps file into a .eps file? > >Thanks for your help! > >Jim Beauchamp j-beauchamp@uiuc.edu > Since several people have asked for this, I am posting a program (read hack) that I wrote that will make some necessary adjustments. Note that this is a hack, and may do some unnecessary stuff, and might miss on a few. However I have found that the results always work out fine, and that is what is important ;-). Usage: ps2eps [-v] <filename> takes <filename> as a '.ps' file and creates filename with '.eps'. Will read and write from stdin/stdout, but only at the same time. If you make any changes/improvements e-mail me a copy! - db ----------------------- #include <stdio.h> #include <string.h> #include <signal.h> /* EDIT ME !!!!!!!!!!!! */ #define DEFAULT_X 612.0 #define DEFAULT_Y 792.0 #define TRUE 1 #define FALSE 0 int verbose; char rem[60]; /* This program was written by Darcy Brockbank, and is free to be */ /* copied, modified, or thrown in the trash as long as this notice*/ /* remains intact. THERE IS NO GUARANTEE as far as the functioning*/ /* and results of using this program are concerned. I tested it on*/ /* a Sun4 and a NeXT Cube and it worked fine. For the most part */ /* this is a cheap hack that allows a nearly conforming PS file to*/ /* be transformed into an EPS file. It was intended to allow one */ /* page graphics in PS to be converted into EPS so they could be */ /* included in documents. If you have the urge to improve this, I */ /* encourage you to mail me the results at samurai@cs.mcgill.ca. */ /* BUG!!! Do not read/write from stdin/stdout with the -v option */ /* remarks will be placed into the output stream. THis is fixed */ /* easily enough 1) make remarks PS comments. 2) send remarks to */ /* stderr instead of stdout. */ /*-------------------------------------------------------------------*/ quit(code) int code; { /* ** This routine will be called when certain ** signals are caught. Do the cleanup before ** exiting. */ system(rem); fprintf(stderr,"\n>>> Caught a signal %d. Goodbye.\n",code); exit(-1); } jobs(input) char *input; { FILE *outfile,*infile; char buffer[256],newbuf[256],dfile[40],file[40]; char *word1,*word2; int linecount,pagesOK,boundingboxOK,atend,fixed,EndComments; EndComments=boundingboxOK=pagesOK=FALSE; if (input!=NULL){ sprintf(file,"%s",input); sprintf((file+strlen(file)-3),".eps"); sprintf(rem,"rm -f %s",file); if (((infile=fopen(input,"r"))==NULL)) { fprintf(stderr,"Cannot open input file \"%s\" for reading.\n",input); system(rem); exit(1); } if (((outfile=fopen(file,"w"))==NULL)) { fprintf(stderr,"Cannot open output file \"%s\" for writing.\n",file); system(rem); exit(1); } } else { infile=stdin; outfile=stdout; } linecount=0; for(fgets(buffer,sizeof(buffer),infile); (!(feof(infile))); fgets(buffer,sizeof(buffer),infile)){ linecount++; if (buffer[0]=='%' && buffer[1]=='!'){ if (verbose){ fprintf(stdout,"**\nRedefining program descriptor: %s as: %%!PS-Adobe-2.0 ESPF-2.0\n",buffer); } sprintf(buffer,"%%!PS-Adobe-2.0 ESPF-2.0\n"); } if (buffer[0]=='%' && buffer[1]=='%'){ strcpy(newbuf,buffer); word1=strtok(newbuf," :\n"); word2=strtok('\0'," \n\t"); if((word1!=NULL) && (strcmp(word1,"%%PageSize")!=0) && (strcmp(word1,"%%PageBoundingBox")!=0) && (strcmp(word1,"%%Feature")!=0)) { if (strcmp(word1,"%%Page")==0){ if (verbose){ fprintf(stdout,"**\n I think that there are multiple pages in the document.\n EPSF files may only have one page.\n I am doing my best to correct the problem, but it may be beyond my abilities.\n"); fprintf(stdout,"**\nStripping: %s on line %d\n",buffer,linecount); } sprintf(buffer,"%%\n"); } if (strcmp(word1,"%%BoundingBox")==0) { boundingboxOK=TRUE; if (verbose){ fprintf(stdout,"**\nFound a %%%%BoundingBox definition on line %d\n",linecount); } if (strcmp(word2,"(atend)")==0){ atend=TRUE; boundingboxOK=FALSE; if (verbose){ fprintf(stdout,"**\n%%%%BoundingBox values deferred to Trailer\n"); } } } if (strcmp(word1,"%%Pages")==0){ pagesOK=TRUE; if (verbose){ fprintf(stdout,"**\nRedefining: %s as: %%%%Pages: 0 1 on line %d\n",buffer,linecount); } sprintf(buffer,"%%%%Pages: 0 1\n"); } if (strcmp(word1,"%%EndComments")==0){ if (verbose){ fprintf(stdout,"**\n Came to end of comments on line %d.\n",linecount); } EndComments=TRUE; } }else{ if (verbose){ fprintf(stdout,"**\nStripping unneccesary definition: %s on line %d.\n",buffer,linecount); } sprintf(buffer,"%%\n"); } if (EndComments) { if (!(pagesOK)) { if (verbose){ fprintf(stdout,"**\nI did not find a valid %%%%Pages declaration.\nI am adding %%%%Pages 0 1 on line %d.",linecount); } linecount++; fprintf(outfile,"%%%%Pages: 0 1\n"); } if (!(boundingboxOK) && !(atend)) { if (verbose){ fprintf(stdout,"**\nI did not find a valid %%%%BoundingBox declaration.\nI am adding one on line %d.\n",linecount); fprintf(stdout,"Note that there are four REAL number values following the %%%%BoundingBox.\nYou may wish to edit these to change the size of your graphic window.\n"); fprintf(stdout,"I am defaulting to a %fx%f point window.\n",DEFAULT_X, DEFAULT_Y); } linecount++; fprintf(outfile,"%%%%BoundingBox: 0 0 %f %f\n", DEFAULT_X, DEFAULT_Y); boundingboxOK=TRUE; } } } else { if ((!(EndComments))&& (!(fixed))&&(buffer[0]!='%')){ if (verbose){ fprintf(stdout,"**\nThere was a badly formed header in the document that will not allow proper\nparsing of the EPS special comments.\nI am inserting a default header section at line %d.\nYou may wish to edit these lines.\n",linecount); } if (!(boundingboxOK) && !(atend)) { if (verbose){ fprintf(stdout,"Inserted %%%%BoundingBox: 0 0 %f %f\n", DEFAULT_X, DEFAULT_Y); } fprintf(outfile,"%%%%BoundingBox: 0 0 %f %f\n", DEFAULT_X, DEFAULT_Y); linecount++; boundingboxOK=TRUE; } if (!(pagesOK)) { if (verbose){ fprintf(stdout,"Inserted %%%%Pages: 0 1\n"); } fprintf(outfile,"%%%%Pages: 0 1\n"); linecount++; pagesOK=TRUE; } if (verbose){ fprintf(stdout,"Inserted %%%%EndComments\n"); } fprintf(outfile,"%%%%EndComments\n"); EndComments=TRUE; fixed=TRUE; } } fprintf(outfile,"%s",buffer); } if (!(boundingboxOK)) { if (verbose){ fprintf(stdout,"**\nI did not find a valid %%%%BoundingBox declaration.\nI am adding one on line %d.\n",linecount); fprintf(stdout,"Note that there are four REAL number values following the %%%%BoundingBox.\nYou may wish to edit these to change the size of your graphic window.\n"); fprintf(stdout,"I am defaulting to a %fx%f point window.\n", DEFAULT_X, DEFAULT_Y); } linecount++; fprintf(outfile,"%%%%Trailer\n%%%%BoundingBox: 0 0 %f %f\n", DEFAULT_X, DEFAULT_Y); } fclose(infile); fclose(outfile); } /*------------------------------------------------------------------------_*/ main(argc,argv) char *argv[]; int argc; { char c,*optarg; int optind,error; /* ** Intercept termination signals. */ signal(SIGINT, quit); signal(SIGTERM, quit); signal(SIGQUIT, quit); signal(SIGBUS, quit); signal(SIGSEGV, quit); verbose=FALSE; error=FALSE; while ((c = getopt(argc, argv, "v")) != EOF) switch (c) { case 'v': verbose=TRUE; optind++; break; case '?': default: error=TRUE; break; } if (verbose){ fprintf(stdout,"**\nWelcome to ps2eps 1.1.\nUse this program to convert PS files into portable EPS files.\nThe converted file has the same name, but the EPS extension.\nSend comments to samurai@cs.mcgill.ca.\n"); } if (error || argc>optind+2 ) { fprintf(stderr, "Usage: ps2eps [-v(erbose)] <infile.ps>\n"); exit(2); } if (argc==1+optind) { jobs(NULL); } else { jobs(argv[argc-1]); } }
eps@toaster.SFSU.EDU (Eric P. Scott) (06/21/91)
1) Try spelling "EPSF" correctly. 2) This program is only useful in severely limited circumstances, generally not those under which I've seen people ask for such a utility. BTW, If you haven't already done so, request send Programs epsfinfo.ps from ps-file-server@adobe.com Remember--PS files can "legally" do things that make it IMPOSSIBLE to convert them to EPSF. -=EPS=-
samurai@cs.mcgill.ca (Darcy BROCKBANK) (06/21/91)
In article <1766@toaster.SFSU.EDU> eps@cs.SFSU.EDU (Eric P. Scott) writes: >1) Try spelling "EPSF" correctly. What the hell got up your butt today? If you have a point, make it. >2) This program is only useful in severely limited circumstances, >generally not those under which I've seen people ask for such a >utility. I use it to take PS graphic files, and transform them to EPS files so that I can include them in WriteNow documents. It has been useful for me. And it does a better job then just sitting there and trying to will your file to change. Anyway, if you have something better then post it, and e-mail me a copy. The only thing that I found to do this was so complicated (needed GhostScript and pbmutils) that it was easier to throw this together. >BTW, If you haven't already done so, request > send Programs epsfinfo.ps >from ps-file-server@adobe.com > >Remember--PS files can "legally" do things that make it >IMPOSSIBLE to convert them to EPSF. Did you even read anything that I wrote? IT WAS/IS A HACK!! I repeatedly said this. And it works fine for the purpose for which I needed it. Read the NextAnswers about converting PS to EPS. All I did was implement the instructions that they gave. If you have a problem with that, perhaps you should give NeXT a ring. > -=EPS=- - db
fletcher@socrates.umd.edu (Charles Fletcher) (06/22/91)
Along this same vain, there is a utility for TeX called 'psfig' (for including PS - actually EPSF - in TeX.) An included utility is 'bbfig' which puts a bounding box on a PS file to make it EPSF. For more info and references see Cameron Smith's article in the latest Mathematica Journal. -Charlie
eps@toaster.SFSU.EDU (Eric P. Scott) (06/22/91)
In article <1991Jun21.160038.25837@cs.mcgill.ca> samurai@cs.mcgill.ca (Darcy BROCKBANK) writes: >What the hell got up your butt today? If you have a point, make it. Your code DOESN'T WORK! How much plainer do you want? >Did you even read anything that I wrote? IT WAS/IS >A HACK!! I repeatedly said this. And it works fine for the purpose for >which I needed it. Read the NextAnswers about converting PS to EPS. I've done better than that--I've read the complete Adobe documentation. (And yes, I have read the June 1991 NeXTanswers.) >I did was implement the instructions that they gave. Actually, you didn't, but that's neither here nor there. Don't cry on my shoulder when you get complaints that your program doesn't work for PostScript produced by something other than a NeXT. -=EPS=-
samurai@cs.mcgill.ca (Darcy BROCKBANK) (06/26/91)
In article <1780@toaster.SFSU.EDU> eps@cs.SFSU.EDU (Eric P. Scott) writes: >In article <1991Jun21.160038.25837@cs.mcgill.ca> > samurai@cs.mcgill.ca (Darcy BROCKBANK) writes: >>What the hell got up your butt today? If you have a point, make it. > >Your code DOESN'T WORK! How much plainer do you want? You lie. It works for me. It has worked for others that have said it was "extremely useful" for them, out there in Netland. >>I did was implement the instructions that they gave. >Actually, you didn't, but that's neither here nor there. You lie again. >Don't cry on my shoulder when you get complaints that your >program doesn't work for PostScript produced by something other >than a NeXT. If it does not work for them, then I would love to hear constructive criticism so I can fix and improve it. I do not need unsupported ranting from some insecure blowhard that is trying to show the whole net just how much he knows about everything. Which seems to be nothing. Before you say anything more do this: a) compile the code I posted. b) take ANY conforming postscript file c) run it through the executable d) see if you can include it in TeX or WriteNow. e) see if the results come out on your Laser Printer. ALL OF THE ABOVE have worked for the NeXT, for the NeXTprinter and for the Apple LaserWriter. I have not claimed anything more than that. I have not claimed perfection. I have not claimed flawlessness. It is a dirty hack, to do a quick and dirty job. And I repeat myself: IF YOU HAVE ANYTHING BETTER, MAIL ME A COPY. If you don't, shut up. - db
anderson@macc.wisc.edu (Jess Anderson) (06/26/91)
In article <1991Jun25.180503.5145@cs.mcgill.ca> samurai@cs.mcgill.ca (Darcy Brockbank) writes: In case you've forgotten, Brockbank was incensed a few days ago that someone commented on another person's spelling. It seems he thinks it's fine for him to be incensed, but not fine for others. He continues in that vein. >In article <1780@toaster.SFSU.EDU> eps@cs.SFSU.EDU (Eric P. >Scott) writes: >>In article <1991Jun21.160038.25837@cs.mcgill.ca> >>samurai@cs.mcgill.ca (Darcy BROCKBANK) writes: >>>What the hell got up your butt today? If you have a point, >>>make it. Being civil often works. Try it, you'll like it. >>Your code DOESN'T WORK! How much plainer do you want? >You lie. To know that, you'd have to know his intention. Perhaps he's only mistaken. Usually people don't get called liars for that. Inasmuch as Eric has helped hundreds of us hundreds of times and in matters of fact nearly always has reliable information, probably he would be quite willing to admit a mistake if he made one. >You lie again. How dreary. >>Don't cry on my shoulder when you get complaints that your >>program doesn't work for PostScript produced by something other >>than a NeXT. >If it does not work for them, then I would love to hear >constructive criticism so I can fix and improve it. Strikes me as a legitmate concern, all right. But who'd want to help a person whose basic approach is contempt? >I do not need unsupported ranting from some insecure >blowhard that is trying to show the whole net just how much >he knows about everything. Which seems to be nothing. On the last point, it's hard to imagine a person being less correct. On the earlier one, rant and blowhard are the operative words, just applied to the wrong person. Try the mirror, son. >Before you say anything more do this: (Says he, commandingly :-) >a) compile the code I posted. >b) take ANY conforming postscript file >c) run it through the executable >d) see if you can include it in TeX or WriteNow. >e) see if the results come out on your Laser Printer. >ALL OF THE ABOVE have worked for the NeXT, for the >NeXTprinter and for the Apple LaserWriter. >I have not claimed anything more than that. I have not >claimed perfection. I have not claimed flawlessness. It is a >dirty hack, to do a quick and dirty job. Someone should thank you, I think: thanks. >And I repeat myself: IF YOU HAVE ANYTHING BETTER, MAIL ME A >COPY. Tried "please" lately? >If you don't, shut up. (He must be moonlighting at the State Department.) <> To seek permission is to seek denial. <> -- Steve Jobs -- Jess Anderson <> Madison Academic Computing Center <> University of Wisconsin Internet: anderson@macc.wisc.edu <-best, UUCP:{}!uwvax!macc.wisc.edu!anderson NeXTmail w/attachments: anderson@yak.macc.wisc.edu Bitnet: anderson@wiscmacc Room 3130 <> 1210 West Dayton Street / Madison WI 53706 <> Phone 608/262-5888
rreid@DPW.COM (r l reid ) (06/26/91)
In article <1991Jun26.033014.18062@macc.wisc.edu> anderson@macc.wisc.edu (Jess Anderson) writes: > ><> To seek permission is to seek denial. ><> -- Steve Jobs Oh for goddess's sake Jess - this quote is a blatant ripoff of the Grace Hopper line "it's always easier to apologize then to get permission". Down with Job's Cult of Personality! Ro
anderson@dogie.macc.wisc.edu (Jess Anderson) (06/26/91)
In article <3338@esquire.dpw.com> rreid@esquire.UUCP (r l reid ) writes: >In article <1991Jun26.033014.18062@macc.wisc.edu> anderson@macc.wisc.edu (Jess Anderson) writes: >><> To seek permission is to seek denial. >><> -- Steve Jobs >Oh for goddess's sake Jess - this quote is a blatant ripoff of the >Grace Hopper line "it's always easier to apologize then to get permission". >Down with Job's Cult of Personality! Maybe she was a role model for the young Mr. Jobs? For an older generation, Hopper was herself something of a cult figure. I don't see the harm in that, within some reasonable limits. Most of us are attracted in one way or another to things that have a koan-like ring to them, and sometimes a lot of good comes from that. There being little new under the sun (a rip-off from Ecclesiastes, if you like), even Hopper's remark is probably not that original. -- Jess Anderson <> Madison Academic Computing Center <> University of Wisconsin Internet: anderson@macc.wisc.edu <-best, UUCP:{}!uwvax!macc.wisc.edu!anderson NeXTmail w/attachments: anderson@yak.macc.wisc.edu Bitnet: anderson@wiscmacc Room 3130 <> 1210 West Dayton Street / Madison WI 53706 <> Phone 608/262-5888
cnh5730@calvin.tamu.edu (Charles Herrick) (06/27/91)
In article <1991Jun26.155148.20973@macc.wisc.edu> anderson@dogie.macc.wisc.edu (Jess Anderson) writes:
There being little new under
the sun (a rip-off from Ecclesiastes, if you like), even
Hopper's remark is probably not that original.
Zen truth, like the laws of Nature, is immutable and eternal, has
always and will always exist. Thus, the demand for originality with
respect to the truth is a contradiction in terms.
That said, beware of quotations of truth ascribed to authority
figures. Usually, the sources are offered to increase the value of the
truth being claimed. Zen truth stands alone and as such, needs no validation.
--
"I am walking on the wire
and the wire is what the whole thing is about."
-- John Stewart