问题描述
如何在 Mathematica 中(可能使用GhostScript?)将.eps转换为.pdf?
How can I convert .eps to .pdf inside Mathematica (perhaps using GhostScript?)?
推荐答案
安装 GhostScript 并设置适当的环境变量(对于Windows,您应该添加gs\bin
和gs\lib
到PATH
,其中gs
是顶级Ghostscript目录),您可以使用 Jens Nöckel将.eps转换为.pdf的方法(将概述所有字形):
After installing GhostScript and setting appropriate environment variables (for Windows you should add gs\bin
and gs\lib
to the PATH
, where gs
is the top-level Ghostscript directory) you can use Jens Nöckel's method for converting .eps to .pdf (all the glyphs will be outlined):
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
替换它.
Here gswin64c.exe
is the name of GhostScript executable for 64bit Windows systems, for Linux replace it with gs
.
另一种基于 Kurt Pfeifle代码的方法(无字体概述):
Another method based on Kurt Pfeifle' code (without font outlining):
gsEPS2PDFEmbedFonts[epsPath_String, pdfOutputPath_String] :=
Run["gswin64c.exe -sFONTPATH=c:/windows/fonts -o \"" <>
pdfOutputPath <>
"\" -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress \"" <> epsPath <>
"\""]
此处c:/windows/fonts
是字体所在的目录.另请参阅此处,以获取有关GhostScript命令行参数的信息.
Here c:/windows/fonts
is the directory where fonts are located. See also here for information about GhostScript command line parameters.
这篇关于如何在Mathematica中将.eps文件转换为.pdf?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!