Converting PDF to EPS on OS X
Recently I discovered that some academic publishers will let you submit PDF figures right up until acceptance, where they then need to be in an "editable" format. Vector figures inside PDF containers are editable of course, but the author guidelines for your journal of choice may well say otherwise, instead offering a list of ancient and bewildering image formats which are deemed acceptable. It's baffling to me why a journal would prefer a
pptx PowerPoint file containing your figure than a modern open standard like
SVG (not a format without consistency issues, admittedly). So for this reason I needed to convert a bunch of PDF figures to EPS (encapsulated postscript) without too much manual effort.
Google lead me to tex.se where a great answer (+1) lists a few different possible methods of going about this conversion. After trying a couple, it turned out the results were often imperfect and sometimes wildly different.
As an example PDF vector image, here's the measles heatmap I put together recently:
How well does this convert with, say, ImageMagick:
convert measles.pdf measles_imagemagick.eps
Wow, I have no idea why that gives such a bad result, maybe it could be improved by tweaking some parameters but I didn't experiment with these.
inkscape measles.pdf --export-eps=measles_inkscape.eps
This looks a bit better, though the bounding box is tightly cropped.
The best out-of-the-box result with this file came from
pdftops (part of xpdf) which maintained PDF margins and converted vector elements reasonably faithfully:
pdftops -eps measles.pdf
git clone git://github.com/blmoore/pdf2eps-osx cd pdf2eps-osx ./pdf2eps example_file.pdf # Converting: example_file.pdf ls converted/ # example_file_gs.eps example_file_inkscape.eps # example_file_imagemagick.eps example_file_pdftops.eps
Maybe I'll properly develop this script in future, using getopts and testing/installing linked programs, but for now it works as a quick hack!