File transfig.3.2.5d-mediaboxrealnb.dif of Package transfig

--- fig2dev/dev/readeps.c
+++ fig2dev/dev/readeps.c	2013-02-08 11:21:58.593945615 +0000
@@ -77,16 +77,22 @@ read_eps_pdf(file, filetype, pic, llx, l
 	while (fgets(buf, 512, file) != NULL) {
 	    /* look for /MediaBox for pdf file */
 	    if (pdf_flag) {
+	      char *s;
+	      for(s=buf; (s=strchr(s,'/')); s++) {
 		if (!strncmp(buf, "/MediaBox", 8)) {	/* look for the MediaBox spec */
-		    c = strchr(buf,'[')+1;
-		    if (c && sscanf(c,"%d %d %d %d",llx,lly,&urx,&ury) < 4) {
+		    c = strchr(s,'[');
+		    if (c && sscanf(c+1,"%d %d %d %d",llx,lly,&urx,&ury) < 4) {
 			*llx = *lly = 0;
 			urx = paperdef[0].width*72;
 			ury = paperdef[0].height*72;
 			put_msg("Bad MediaBox in imported PDF file %s, assuming %s size", 
 				pic->file, metric? "A4" : "Letter" );
 		    }
+		    pic->bit_size.x = (urx-(*llx));
+		    pic->bit_size.y = (ury-(*lly));
+		    break;
 		}
+	      }
 	    /* look for bounding box for EPS file */
 	    } else if (!nested && !strncmp(buf, "%%BoundingBox:", 14)) {
 		c=buf+14;
openSUSE Build Service is sponsored by