【发布时间】:2013-09-09 22:53:24
【问题描述】:
如何在 Mathematica 中将 .eps 转换为 .pdf(可能使用 GhostScript?)?
【问题讨论】:
标签: wolfram-mathematica ghostscript
如何在 Mathematica 中将 .eps 转换为 .pdf(可能使用 GhostScript?)?
【问题讨论】:
标签: wolfram-mathematica ghostscript
安装GhostScript 并设置适当的环境变量(对于Windows,您将should 添加gs\bin 和gs\lib 到PATH,其中gs 是顶级Ghostscript 目录)您可以使用@ 987654323@ 用于将 .eps 转换为 .pdf(将概述所有字形):
gsEPS2PDF[epsPath_String, pdfPath_String] :=
Run["gswin64c.exe -sDEVICE=pdfwrite -dNOCACHE -sOutputFile=\"" <>
pdfPath <> "\" -q -dbatch -dNOPAUSE \"" <> epsPath <> "\" -c quit"]
这里 gswin64c.exe 是 64 位 Windows 系统的 GhostScript 可执行文件的名称,对于 Linux 将其替换为 gs。
基于Kurt Pfeifle' code的另一种方法(无字体轮廓):
gsEPS2PDFEmbedFonts[epsPath_String, pdfOutputPath_String] :=
Run["gswin64c.exe -sFONTPATH=c:/windows/fonts -o \"" <>
pdfOutputPath <>
"\" -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress \"" <> epsPath <>
"\""]
这里c:/windows/fonts是字体所在的目录。有关 GhostScript 命令行参数的信息,另请参阅 here。
【讨论】:
gr = Import["file.eps", "eps"]
Export["file.pdf", gr, "pdf"]
【讨论】:
Importing 返回$Failed,就像this 文件一样。