119

I can't find a tool to convert PDF to EPS, neither in MikTeX nor in TeXLive. Is there such a tool actually?


Update:

Based on Herbert's accepted answer, I simplify his batch as follows:

#!/bin/sh
# $Id: pdf2eps,v 0.01 2005/10/28 00:55:46 Herbert Voss Exp $
# Convert PDF to encapsulated PostScript.
# usage:
# pdf2eps <page number> <pdf file without ext>

pdfcrop "$2.pdf" "$2-temp.pdf"
pdftops -f $1 -l $1 -eps "$2-temp.pdf" "$2.eps"
rm  "$2-temp.pdf"

For Windows users, create a batch file, name it pdf2eps.bat as follows:

rem pdf2eps <page number> <pdf file without ext>
echo off
pdfcrop "%2.pdf" "%2-temp.pdf"
pdftops -f %1 -l %1 -eps "%2-temp.pdf" "%2.eps"
del  "%2-temp.pdf"
4
  • @xport: The way I see it, is that can't belongs to find a converter while neither belongs to MikTeX nor TeXLive and not to can or can't find. Jun 16, 2011 at 14:33
  • @Peter: I see, but also note that people there point out that the original sentence doesn't sound natural (comment of Unreason) and can be confusing (Martha's answer). So I would suggest to write "I can't find a converter to convert PDF to EPS either in MikTeX or TeXLive" (as suggested in the TeX.SX thread). Also "converter to convert" doesn't sound good. Anyway, instead of starting a lengthly discussion here, just change the text back. Edits from the moderators are not carved in stone or in any way binding. Jun 16, 2011 at 15:26
  • 2
    @Martin We are in violent agreement!
    – Peter K.
    Jun 16, 2011 at 17:47
  • @Alan: Thanks! I fully agree with the "can't" and the comma. The original "can" version is just too confusing. Jun 23, 2011 at 16:09

11 Answers 11

77

Here is a Linux script pdf2eps. It can easily be translated into a batch script for Windows.

#!/bin/sh
# $Id: pdf2eps,v 0.01 2005/10/28 00:55:46 Herbert Voss Exp $
# Convert PDF to encapsulated PostScript.
# usage:
# pdf2eps <page number> <pdf file without ext>

pdfcrop $2.pdf
pdftops -f $1 -l $1 -eps "$2-crop.pdf" 
rm  "$2-crop.pdf"
mv  "$2-crop.eps" $2.eps
6
  • I see. I forget to include the --gscmd gswin64c because I have 2 ghostscript installed. Jun 16, 2011 at 9:45
  • 4
    To make sure that the script works with arguments that include a space I'd recommend to put all references for $1 and $2 in double quotes, like so: "$2.pdf". Jun 24, 2011 at 16:34
  • 1
    no, spaces in filenames should not be supported ...
    – user2478
    Jun 28, 2011 at 17:36
  • 3
    If any of the commands fails, the script will continue, while it shouldn't. Put set -e in the beginning. Jul 10, 2011 at 13:05
  • This solution produced a very low quality output (e.g. compared to the Inkscape solution suggested by Martin Scharrer). Oct 3, 2018 at 9:48
101

Providing such a tool is not the task of a TeX distribution. You need to use an external tool.

There are a couple of them which should be able to convert PDF to EPS, sometimes by going over PS first.

I can recommend the following 3 tools which produce nice results for me:

  • Inkscape (Vector graphic editor, free & multi-platform)

Can be either used using the GUI (open PDF, save as EPS) or using the command line (tested under Linux only):

inkscape input.pdf --export-eps=output.eps

inkscape input.pdf --export-filename=output.eps
  • Acrobat Reader (Linux Version) + ps2eps (TeXLive)

    acroread -toPostScript input.pdf
    ps2eps input.ps
    
  • Ghostscript (multi-platform)
    Note: -dNOCACHE is needed to prevent GhostScript from rastering the fonts. eps2write was formerly used as epswrite.

    gs -q -dNOCACHE -dNOPAUSE -dBATCH -dSAFER -sDEVICE=eps2write -sOutputFile=output.eps input.pdf
    

There are also the following tools. I didn't tested all of them and some raster the fonts :-( !

  • ImageMagick convert (which might use Ghostscript itself. Calling it manually if more flexible and might avoid issues. convert might actually raster the PDF!)

    convert input.pdf output.eps
    
  • pdf2ps (uses Ghostscript) + ps2eps (comes with TeXLive)

  • pdftops (part of poppler), use the -eps switch for EPS output.

and most likely more.

21
  • 11
    Of these options, I recommend pdftops, using the format pdftops -level3 -eps file.pdf file.eps. The result isn't quite strictly EPS for some reason though. I pipe through sed '2s/^/%/' to force the proper double % comment format for the second line (most tools do not care about this, but some might).
    – Lev Bishop
    Jun 16, 2011 at 15:44
  • 3
    @xport: I now figure out that Inkscape allows for command line arguments to directly convert formats. I added the command. It runs under Windows, Mac and Linux! Jun 24, 2011 at 16:29
  • 2
    @xport: I found out that inkscape support command line arguments for conversion. It produces nice results! It is also able to produce SVG which are nice for online content. Jul 5, 2011 at 17:23
  • 2
    +1 for the reference to Inkscape which produced the best results for me in Windows.
    – dafmetal
    May 3, 2012 at 9:07
  • 5
    It looks like ghostscript's eps driver is now called eps2write (I've got version 9.15, not sure when it changed). Otherwise the command still works! Mar 8, 2015 at 2:06
13

I've tried a number of options, including converting with Inkscape and using pdftops with the eps flag turned on. Both have problems with certain fonts. The online tools and ImageMagick both rasterize the image unacceptably.

I found that the most effective process is to convert in two steps: first convert the .pdf to .ps using pdftops, which preserves the fonts and doesn't rasterize the image. Next, convert the .ps to .eps using ps2eps (comes with the TeXLive distro).

A bash script I use to do this:

#!/bin/bash
# Convert PDF to encapsulated PostScript
# usage: pdf2eps <filename.pdf>

# Remove .pdf extension from input
filename=$(echo $1 | sed 's/.pdf//')
# Convert into .eps
pdftops $filename.pdf $filename-temp.ps
ps2eps $filename-temp.ps
mv $filename-temp.eps $filename.eps
rm $filename-temp.ps
0
10

Unfortunately, the EPS format does not handle transparency. If the PDF source file includes transparency, then the tools listed above will rasterize the image in the EPS output, leading to pixelation and larger file sizes. One possible solution is to use an EPS file with non-standard extensions (link).

Conversion from PDF to EPS can be achieved without pixelation using the Adobe Acrobat software. I selected Save As..., and then Format -> Encapsulated Postscript. Under Settings... I have noticed that the General -> Binary option slightly reduces file size. On OS X, I find that Color Management -> Color Profile -> Apple RGB preserves screen display colors. The output EPS file is larger than the PDF source, but otherwise looks the same to me.

4

I think that the best method to convert PDFs to eps files is to use a conventional PDF reader (Acrobat or Okular) to print the PDF to a file with the extension eps. More specifically, I used the usual option "print to file" available in the print dialog window and changed the extension of the destination file to eps. I tried it and it works very well and conserves to a large scale the quality of the document.

3
  • 2
    Welcome to TeX.SE! What have one to do to follow your solution? Can you explain more please, for example what did you exactly when you tried it?
    – Mensch
    Oct 1, 2014 at 16:02
  • As it stands, it is not a real answer, but more like a comment
    – user31729
    Oct 1, 2014 at 16:09
  • 1
    Hi Farid, can you please edit your answer add this information to it? Otherwise it could be that your answer will be converted to a comment (see comment of @Christian Hupfer). A valid answer should have a description that leads to a solution, if a reader follows it. Your answer until now does it not.
    – Mensch
    Oct 1, 2014 at 16:31
3

Copied from http://www.iml.ece.mcgill.ca/~stephan/oopdf2eps

It worked very well

#!/bin/bash

TARGET=${1%.pdf}.eps
echo "pdftops -eps ${1} - | ps2eps > ${TARGET}"
pdftops -eps ${1} - | ps2eps > ${TARGET}
echo "ps2eps stdout redirected to: ${TARGET}"
0
2

Most solutions rasterize the PDF-file resulting in large files. In my case, inkscape failed because some characters are missing (ligatures like ff, fl). Acroread worked in one case, the other failed because of a wrong bounding box.

My solution was, to use the document viewer (Ubuntu 13.10) and to print the document into a file with the Postscript-option (the resulting file is vector based). The postscript file could be converted with ps2eps.

1
  • awesome solution.
    – CKM
    Apr 23, 2020 at 10:21
2

I'm not really experienced with scripts, so I did it "manually".

  1. Open the pdf in Inkscape
  2. Rasterize the file (CtrlShiftE or File -> Rasterize). This option can export to .png only but after you get png file you can easily convert it to .eps or any picture file type. The options of picture resolution and picture size are available.

I know that this way is not optimal and probably don't suit any case, but it took less time than to learn how to use the scripts mentioned above and to test them.

P.S. BTW, most online pdf-to-eps tools works ugly.

1
  • 6
    "not optimal" is a nice expression, when you smash vector graphics to bitmaps.
    – math
    Apr 9, 2014 at 7:56
1

pdftops sometimes messes up the bounding box. I use Adobe Illustrator to get the job done. The file size is usually 5 times larger.

I know it is a heavy and expensive tool for a simple job, but if you do have it already, why not use it. :)

1

On Windows (with gsview installed) I do the following:

  1. Open file.pdf in gsview.
  2. File/Select/Convert and choose 'epswrite' as your Device.
  3. Pat yourself on the back.
1
  • Using gsview worked the best for me, as mentioned by Brent Farwick. I just want to add that having -dNOCACHE as an option avoided to raster the fonts and allowed to get perfect result.
    – user67703
    Dec 9, 2014 at 12:23
0

I tried with most of the above-mentioned options and all produced a significant decrease in quality. I found it very well to open the .pdf in Okular and then "save as" (don't export) as pdf but you manipulate the file extension to .eps.

1
  • Welcome to TeX.SE!
    – Mensch
    Oct 4, 2021 at 10:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .