@@ -1363,7 +1363,8 @@ def gs_distill(tmpfile, eps=False, ptype='letter', bbox=None, rotated=False):
13631363 operators. The output is low-level, converting text to outlines.
13641364 """
13651365
1366- paper_option = "-sPAPERSIZE=%s" % ptype
1366+ if eps : paper_option = "-dEPSCrop"
1367+ else : paper_option = "-sPAPERSIZE=%s" % ptype
13671368
13681369 psfile = tmpfile + '.ps'
13691370 outfile = tmpfile + '.output'
@@ -1385,14 +1386,6 @@ def gs_distill(tmpfile, eps=False, ptype='letter', bbox=None, rotated=False):
13851386 shutil .move (psfile , tmpfile )
13861387
13871388
1388- # While it is best if above steps preserve the original bounding
1389- # box, it does not seems to be the case. pstoeps not only convert
1390- # the input to eps format, but also restores the original bbox.
1391-
1392- if eps :
1393- pstoeps (tmpfile , bbox , rotated = rotated )
1394-
1395-
13961389def xpdf_distill (tmpfile , eps = False , ptype = 'letter' , bbox = None , rotated = False ):
13971390 """
13981391 Use ghostscript's ps2pdf and xpdf's/poppler's pdftops to distill a file.
@@ -1432,17 +1425,9 @@ def xpdf_distill(tmpfile, eps=False, ptype='letter', bbox=None, rotated=False):
14321425 os .remove (tmpfile )
14331426 shutil .move (psfile , tmpfile )
14341427
1435-
1436- # Similar to the gs_distillier case, ps2pdf does not seem to
1437- # preserve the bbox of the original file (at least w/ gs
1438- # 8.61). Thus, the original bbox need to be resotred.
1439-
1440- if eps :
1441- pstoeps (tmpfile , bbox , rotated )
14421428 for fname in glob .glob (tmpfile + '.*' ):
14431429 os .remove (fname )
14441430
1445-
14461431def get_bbox_header (lbrt , rotated = False ):
14471432 """
14481433 return a postscript header stringfor the given bbox lbrt=(l, b, r, t).
0 commit comments