How can I convert .eps to .pdf inside Mathematica (perhaps using GhostScript?)?
Asked
Active
Viewed 592 times
2 Answers
2
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"]
Here gswin64c.exe
is the name of GhostScript executable for 64bit Windows systems, for Linux replace it with gs
.
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 <>
"\""]
Here c:/windows/fonts
is the directory where fonts are located. See also here for information about GhostScript command line parameters.

Community
- 1
- 1

Alexey Popkov
- 9,355
- 4
- 42
- 93
0
gr = Import["file.eps", "eps"]
Export["file.pdf", gr, "pdf"]

Vahagn Poghosyan
- 169
- 6
-
In most cases `Import`ing of .eps files returns `$Failed` as for [this](http://stackoverflow.com/questions/18647024/how-can-i-import-eps-in-mathematica-without-losing-the-text?lq=1#comment27602188_18647024) file. – Alexey Popkov Sep 23 '13 at 07:50