4.83333

4.8 | 6 ratings Rate this file 92 downloads (last 30 days) File Size: 2.14 KB File ID: #16179

save2pdf

by Gabe Hoffmann

 

30 Aug 2007 (Updated 15 Jan 2008)

No BSD License  

Saves a figure as a PDF as it appears on the screen.

Download Now | Watch this File

File Information
Description

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.

Acknowledgements
This submission has inspired the following:
saveas2.m v1.1 (Sep 2009)
MATLAB release MATLAB 7.4 (R2007a)
Other requirements Has been tested on Windows (XP) and Linux (Fedora Core 7).
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (6)
05 Sep 2007 Dan Kominsky

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?

14 Feb 2008 Nathan Miller

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.

15 Feb 2008 Tim Woolmer

Great stuff - just what I needed. Thanks!

30 Aug 2008 A S

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.

20 Oct 2008 Richard Stephens

Excellent. Just what I was looking for.

09 Oct 2009 Neil Dalchau

Great function, provided perfect solution first time around!
Many thanks

Please login to add a comment or rating.
Updates
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.

15 Jan 2008

Improved functioning of GUI dialog box.

Tag Activity for this File
Tag Applied By Date/Time
graphics import Gabe Hoffmann 22 Oct 2008 09:24:58
graphics export Gabe Hoffmann 22 Oct 2008 09:24:58
figure save pdf file Gabe Hoffmann 22 Oct 2008 09:24:58
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com