File Exchange

## eps2pdf

version 1.0 (4.23 KB) by

Converts an EPS file to a PDF file.

4.57143
20 Ratings

Updated

EPS2PDF converts an existing EPS file to a PDF file using Ghostscript. EPS2PDF reads an eps file, modifies the bounding box and creates a pdf file whose size is determined by the bounding box and not by the paper size. This can not be
accomplished by using Ghostscript only. So, all that one needs is of course MATLAB and Ghostscript drivers.

This tool is especially suited for LaTeX (TeX) users who want to create pdf documents on the fly (by including pdf graphics and using either pdftex or pdflatex). An example would be, if you are using LaTeX (TeX) to typeset documents then the usual (simple) way to include graphics is to include eps graphics using for example (if there exists myfigure.eps)

\begin{figure}
\centering
\includegraphics[scale=0.8]{myfigure}\\
\caption{some caption.}
\end{figure}

To use pdflatex (pdftex) you do not need to change anything but provide another file myfigure.pdf in the same directory along with myfigure.eps. And this file, of course, can be generated by EPS2PDF.

haibo

### haibo (view profile)

Thanks! Perfect! This script has worked very well for me through a 64-bit Windows 7 machine.

James jayimbo@gmail.com

### James jayimbo@gmail.com (view profile)

I found the solution to my query, a setting had changed on the postscript printer dialogue box. The advanced printer settings tab's postscript options had somehow changed to 'Optimize for speed' instead of 'Encapsulated Postscript (EPS)' so when i sent a diagram to print to file (ps), something was missing.

James jayimbo@gmail.com

### James jayimbo@gmail.com (view profile)

I have been using your very useful eps2pdf converter for a number of years. Suddenly it refuses to remove whitespace from my postscript (eps) diagrams. When I convert from .ps to .eps the whitespce is removed but when I convert from eps2pdf the whitespace comes back. Kindly advise on what I should do.
(Unfortunately I cant see how to upload my eps file here)
Thanks

Jeppe Druedahl

### Jeppe Druedahl (view profile)

This is very good script. On a 64-bit Windows 7 machine I sometimes get the error

"r6016: not enough space for thread data"

The error disappears when I use a 32-bit version of Ghostscript.

David T

### David T (view profile)

This script has worked very well for me through Windows XP and Windows 7. Note, that you do need to locate the exact path to the ghostscript file on your local drive. The example provided in the .m notes is just that, an example and will likely not reflect where the gs file is located on your machine.

For Windows 7, i found that the OS doesn't have a suitable gs to path to. www.ghostscript.com has a free download for ghostscript 9.07 which resolves this problem. Just path to the .exe and change the eps2pdf script to the correct file name and you're all set.

Spase

### Spase (view profile)

I just downloaded the code but I’m having a problem using it.
I have a Ghostscript version 9.05 running on 64 bit Windows 7, so I changed the part of the code to be gswin64c.exe instead of gswin32c.exe, and I included the right path as input argument, but it shows me the error “Ghostscript executable could not be found: c:\programfiles\gs\gs9.05\bin\gswin64c.exe”

Does anyone have any idea how could I solve this?

Eike

Marmar

### Marmar (view profile)

Many thanks for this helpful code. Would you please let me how you give the resource and dest addresses via an example?

Maria

Big big thanks!

Uli

### Uli (view profile)

Great job. Thanks a lot!

Folkert

### Folkert (view profile)

Beware that this does not embed fonts in the PDF generated! I used this to create figures for an IEEE paper (which requires all fonts to be embedded) with pdflatex. The only way to get all fonts embedded was to embed them in the figures.

I did this by adding the following options to GS_PARAMETERS:

-dEmbedAllFonts=true
-dSubsetFonts=true
-dCompatibilityLevel=1.4
-dPDFSETTINGS=/printer

It might be an idea to include these options by default or to comment on this in the comment for the file.

Apart from that it is a great function, I combine it with the function 'exportfig'.

Ran

### Ran (view profile)

This is exactly what I want!

J.Paul Rinehimer

Fabio Caponetti

### Fabio Caponetti (view profile)

Works smoothly under Linux!:)

Mark Tschopp

This script works great!

Zhaowen Wang

it helps a lot!

h h

c

Jan K.

wonderful, thank you very much!

Ryan Edwards

This function is exactly what's needed to convert EPS files printed from MATLAB into PDF's that can be interpreted correctly by pdflatex. (A rant: I think it's stupid that pdflatex cannot directly place EPS or PS files when standard latex can. I'm sure there's a reason, but I still think it's stupid. Annoying nuances like this will keep people using Word). Anyway, I'm looking forward to putting this function through its paces with some papers I'm writing. Many thanks for this contribution.

dsg dghnd

Sebastian F

Just what I was looking for!!!!!!!!!!
Thanks, thanks, thanks!!!!

evgeni lomonosov

great!

Steve B

Thanks!!!! This is perfect!

Michael Hofer

Very useful, many thanks!

Excellent! Thanks a lot Primoz! After a few hours of searching, I found the perfect answer here.