Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4ba9be1

Browse filesBrowse files
committed
Pass options to ps2pdf using -foo#bar instead of -foo=bar.
The former works both on Windows and Linux (so we can stick to it) whereas the later only works on Linux (so we had to use a switch depending on the OS).
1 parent 4753f6c commit 4ba9be1
Copy full SHA for 4ba9be1

File tree

1 file changed

+11
-21
lines changed
Filter options

1 file changed

+11
-21
lines changed

‎lib/matplotlib/backends/backend_ps.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_ps.py
+11-21Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,26 +1546,16 @@ def xpdf_distill(tmpfile, eps=False, ptype='letter', bbox=None, rotated=False):
15461546
pdffile = tmpfile + '.pdf'
15471547
psfile = tmpfile + '.ps'
15481548

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]
15691559
_log.debug(command)
15701560

15711561
try:
@@ -1624,7 +1614,7 @@ def get_bbox(tmpfile, bbox):
16241614
"""
16251615

16261616
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]
16281618
_log.debug(command)
16291619
p = subprocess.Popen(command, stdin=subprocess.PIPE,
16301620
stdout=subprocess.PIPE, stderr=subprocess.PIPE,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.