Tuesday, September 8, 2009

Batch convert EPS to PDF

In Mac OS X, the application Preview will automatically open your EPS files as PDFs and offer you to save it as PDF when you are done. However, sometimes it does not manage to convert to PDF properly. You may then resort to the command ps2pdf

To batch convert several EPS files in your current directory, do the following at a command line prompt:
FILES="*.eps"
for f in $FILES; do ps2pdf -dEPSCrop $f; done

This will convert all your EPS files to PDF and ensure that they are cropped properly. If you actually prefer to use an entire A4 (or letter size) page for your figure, leave out the -dEPSCrop flag.

No comments: