There are times when you need to export your Matlab figure to the PDF format. One of those times may be, when you intend to use PDF figures inside LaTeX and compile it with pdflatex. Unfortunately Matlab does not allow saving the figure directly in the PDF format. One way circumvent this is to print the current figure using:

print -painters -dpdf -r600 test.pdf

That is not the best solution, since your figure will be unbounded and placed in the middle of a huge white page. If you need your picture with pre-set bounds, then here is my way to do it:
- Set up your figure size and looks
- Save your figure into EPS
- Download and install Ghostscript
- Download this m-file by Primoz Cermelj and add it to your path
- Convert the saved EPS into PDF using the m-file by entering: eps2pdf(‘name_of_the_eps_file.eps’,’C:\path\to\ghostscript\ghostrcriptexecutable.exe’)

There are times when you need to export your Matlab figure to the PDF format. One of those times may be, when you intend to use PDF figures inside LaTeX and compile it with pdflatex. Unfortunately Matlab does not allow saving the figure directly in the PDF format. One way circumvent this is to print the current figure using:

print -painters -dpdf -r600 test.pdf

That is not the best solution, since your figure will be unbounded and placed in the middle of a huge white page. If you need your picture with pre-set bounds, then here is my way to do it:

  1. - Set up your figure size and looks
  2. - Save your figure into EPS
  3. - Download and install Ghostscript
  4. - Download this m-file by Primoz Cermelj and add it to your path
  5. - Convert the saved EPS into PDF using the m-file by entering: eps2pdf(‘name_of_the_eps_file.eps’,’C:\path\to\ghostscript\ghostrcriptexecutable.exe’)