@@ -1096,16 +1096,24 @@ def _print_figure_tex(self, outfile, format, dpi, facecolor, edgecolor,
10961096 isLandscape = True
10971097 width , height = height , width
10981098 bbox = (lly , llx , ury , urx )
1099- temp_papertype = _get_papertype (width , height )
1100- if papertype == 'auto' :
1101- papertype = temp_papertype
1102- paperWidth , paperHeight = papersize [temp_papertype ]
1099+
1100+ # set the paper size to the figure size if isEPSF. The
1101+ # resulting ps file has the given size with correct bounding
1102+ # box so that there is no need to call 'pstoeps'
1103+ if isEPSF :
1104+ paperWidth , paperHeight = self .figure .get_size_inches ()
11031105 else :
1104- paperWidth , paperHeight = papersize [papertype ]
1105- if (width > paperWidth or height > paperHeight ) and isEPSF :
1106+ temp_papertype = _get_papertype (width , height )
1107+ if papertype == 'auto' :
1108+ papertype = temp_papertype
11061109 paperWidth , paperHeight = papersize [temp_papertype ]
1107- verbose .report ('Your figure is too big to fit on %s paper. %s \
1108- paper will be used to prevent clipping.'% (papertype , temp_papertype ), 'helpful' )
1110+ else :
1111+ paperWidth , paperHeight = papersize [papertype ]
1112+ if (width > paperWidth or height > paperHeight ) and isEPSF :
1113+ paperWidth , paperHeight = papersize [temp_papertype ]
1114+ verbose .report ('Your figure is too big to fit on %s paper. %s \
1115+ paper will be used to prevent clipping.'% (papertype , temp_papertype ), 'helpful' )
1116+
11091117
11101118 texmanager = renderer .get_texmanager ()
11111119 font_preamble = texmanager .get_font_preamble ()
@@ -1247,8 +1255,14 @@ def gs_distill(tmpfile, eps=False, ptype='letter', bbox=None):
12471255 os .remove (outfile )
12481256 os .remove (tmpfile )
12491257 shutil .move (psfile , tmpfile )
1250- if eps :
1251- pstoeps (tmpfile , bbox )
1258+
1259+
1260+
1261+ # Since the the paper size is set to the figure size for eps
1262+ # output (in '_print_figure_tex'), pstoeps call is not required.
1263+
1264+ #if eps:
1265+ # pstoeps(tmpfile, bbox)
12521266
12531267
12541268def xpdf_distill (tmpfile , eps = False , ptype = 'letter' , bbox = None ):
0 commit comments