@@ -1546,26 +1546,16 @@ def xpdf_distill(tmpfile, eps=False, ptype='letter', bbox=None, rotated=False):
1546
1546
pdffile = tmpfile + '.pdf'
1547
1547
psfile = tmpfile + '.ps'
1548
1548
1549
- if eps :
1550
- paper_option = "-dEPSCrop"
1551
- else :
1552
- if sys .platform == "win32" :
1553
- paper_option = "-sPAPERSIZE#%s" % ptype
1554
- else :
1555
- paper_option = "-sPAPERSIZE=%s" % ptype
1556
-
1557
- if sys .platform == "win32" :
1558
- command = [str ("ps2pdf" ), "-dAutoFilterColorImages#false" ,
1559
- "-dAutoFilterGrayImages#false" ,
1560
- "-sGrayImageFilter#FlateEncode" ,
1561
- "-sColorImageFilter#FlateEncode" , paper_option , tmpfile ,
1562
- pdffile ]
1563
- else :
1564
- command = [str ("ps2pdf" ), "-dAutoFilterColorImages=false" ,
1565
- "-dAutoFilterGrayImages=false" ,
1566
- "-sGrayImageFilter=FlateEncode" ,
1567
- "-sColorImageFilter=FlateEncode" , paper_option , tmpfile ,
1568
- pdffile ]
1549
+ # Pass options as `-foo#bar` instead of `-foo=bar` to keep Windows happy
1550
+ # (https://www.ghostscript.com/doc/9.22/Use.htm#MS_Windows).
1551
+ command = [str ("ps2pdf" ),
1552
+ "-dAutoFilterColorImages#false" ,
1553
+ "-dAutoFilterGrayImages#false" ,
1554
+ "-dAutoRotatePages#false" ,
1555
+ "-sGrayImageFilter#FlateEncode" ,
1556
+ "-sColorImageFilter#FlateEncode" ,
1557
+ "-dEPSCrop" if eps else "-sPAPERSIZE#%s" % ptype ,
1558
+ tmpfile , pdffile ]
1569
1559
_log .debug (command )
1570
1560
1571
1561
try :
@@ -1624,7 +1614,7 @@ def get_bbox(tmpfile, bbox):
1624
1614
"""
1625
1615
1626
1616
gs_exe = ps_backend_helper .gs_exe
1627
- command = [gs_exe , "-dBATCH" , "-dNOPAUSE" , "-sDEVICE=bbox" "%s" % tmpfile ]
1617
+ command = [gs_exe , "-dBATCH" , "-dNOPAUSE" , "-sDEVICE=bbox" , "%s" % tmpfile ]
1628
1618
_log .debug (command )
1629
1619
p = subprocess .Popen (command , stdin = subprocess .PIPE ,
1630
1620
stdout = subprocess .PIPE , stderr = subprocess .PIPE ,
0 commit comments