【问题标题】:How can I convert .eps file to .pdf in Mathematica?如何在 Mathematica 中将 .eps 文件转换为 .pdf?
【发布时间】:2013-09-09 22:53:24
【问题描述】:

如何在 Mathematica 中将 .eps 转换为 .pdf(可能使用 GhostScript?)?

【问题讨论】:

    标签: wolfram-mathematica ghostscript


    【解决方案1】:

    安装GhostScript 并设置适当的环境变量(对于Windows,您将should 添加gs\bings\libPATH,其中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

    【讨论】:

      【解决方案2】:
      gr = Import["file.eps", "eps"]
      Export["file.pdf", gr, "pdf"]
      

      【讨论】:

      • 在大多数情况下,.eps 文件的Importing 返回$Failed,就像this 文件一样。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-28
      • 1970-01-01
      • 1970-01-01
      • 2018-01-31
      • 2019-11-24
      • 1970-01-01
      相关资源
      最近更新 更多