#include #include #include #include void process(char *name) { FILE *in,*out; char a[256],c[4][20]; int i; if((in=fopen(name,"r"))==NULL) { printf("I can't open file %s for reading.\n",name); return; } do { fscanf(in,"%s",a); } while(!feof(in) && strcmp(a,"%%BoundingBox:")); if(feof(in)) { printf("I can't find %%%%BoundingBox: informations in EPS %s.\n",name); return; } strcpy(a,name); for(i=strlen(a);i && a[i]!='.' && a[i]!='\\' && a[i]!='/';i--); if(a[i]=='.') a[i]=0; strcat(a,".pdf"); for(i=0;i<4;i++) fscanf(in,"%s",c[i]); out=fopen("eps2pdf.!!1","w"); fprintf(out,"-sDEVICE=pdfwrite -dCompatibilityLevel=1.1 -dNOPAUSE " "-sOutputFile=%s ",a); fclose(out); out=fopen("eps2pdf.!!2","w"); fprintf(out,"/Width { %s %s sub } bind def /Height { %s %s sub } bind def " "<< /PageSize [Width Height] >> setpagedevice " "%s neg %s neg translate ", c[2],c[0],c[3],c[1],c[0],c[1]); fclose(out); spawnl(P_WAIT,searchpath("gswin32c.exe"),"","@eps2pdf.!!1","eps2pdf.!!2", name,"-c","showpage","quit",NULL); remove("eps2pdf.!!1"); remove("eps2pdf.!!2"); fclose(in); } int main(int argc,char *argv[]) { struct ffblk fblk; int i,done; if(argc==1) { printf("Usage: eps2pdf filename.eps [filename...]\n" "Wildcards are allowed.\n"); return(1); } printf("This is eps2pdf 1.01.\n"); for(i=1;i