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)
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.
Primoz Cermelj (2020). eps2pdf (https://www.mathworks.com/matlabcentral/fileexchange/5782-eps2pdf), MATLAB Central File Exchange. Retrieved .
aspect ratio is not the same.
Seems that the generated pdf figures do not have a bounding box:(
I have a Matlab script where I produce a figure, and then create an eps file in my current directory using the command
print('myFile','-depsc'). Immediately following, I have: mypdf = eps2pdf('myFile').
I get the error message that 'Error while creating temporary eps file: ..... cannot be accessed or does not exist'.
Has anyone had a similar problem?
Thanks! Perfect! This script has worked very well for me through a 64-bit Windows 7 machine.
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.
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)
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.
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.
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?
Many thanks for this helpful code. Would you please let me how you give the resource and dest addresses via an example?
This is genial and works on Linux!!! I am glad I have found this page!
Big big thanks!
Great job. Thanks a lot!
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:
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'.
This is exactly what I want!
Works smoothly under Linux!:)
This script works great!
it helps a lot!
wonderful, thank you very much!
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.
Just what I was looking for!!!!!!!!!!
Thanks, thanks, thanks!!!!
Thanks!!!! This is perfect!
Very useful, many thanks!
Excellent! Thanks a lot Primoz! After a few hours of searching, I found the perfect answer here.
Minor changes to enhance usability
Optimized for speed