SAVE2PDF saves a figure as a PDF as it appears on the screen. SAVE2PDF is stand-alone and simple--it does not require a separate installation of ghostscript. It saves figures as they appear on the screen, with the correct page size. It has the option to change the resolution to be print-quality.
SAVE2PDF is particularly useful for LaTex users who want to generate PDFs to include when compiling with pdftex. The vector art information is preserved.
This function simply augments the built in print-to-pdf functionality of Matlab by resizing the output PDF and shifting the displayed plot.
Love the program, but came across a bug, at least on my machine. Don't seem to be able to upload a pdf file, but hopefully if you run the code below you'll see the problem. In the title for the first subplot, save2pdf throws in a space that's not present in either the matlab figure or the pdf generated by matlab's print function. In the second and third subplot the modified titles don't have the same problem. Really wierd!
Very handy function, thanks. Just a suggestion: force the 'paperOrientation' property to 'landscape' (that is usually the default); if it has been changed to 'landscape', the function will not produce the expected output.
Great function, provided perfect solution first time around!
20 Oct 2008
Excellent. Just what I was looking for.
30 Aug 2008
Works good and helps a lot with mass-pdf-graph-generation ... pdf2ps in linux doesn't generate vectorized .ps from these pdfs, but that's not Gabe's fault.
15 Feb 2008
Great stuff - just what I needed. Thanks!
14 Feb 2008
Works great and I don't have to manually crop the pdfs.
The only problem I have is that the legend output is different whether you use the command line 'print' or select "save as" from the figure menu. Using 'print', the legend background color is lost and the black outline shows up even when set to white. However, this is a matlab bug, not this code's problem.
05 Sep 2007
Nice and does what it says. But what I'm really interested in is how to save multiple figures to a multi-page pdf without ghostscript. Any thoughts?
24 Sep 2007
Added "Save As" dialog box, so that file name can be omitted in the function call, and ability to change the resolution of the output. Default resolution would be 150 dpi, but typical print-quality should be around 600 dpi.