File Exchange

image thumbnail

saveaspdf

version 1.0 (2.72 KB) by

Save a figure as a clean pdf file ready for publication.

4.66667
3 Ratings

2 Downloads

Updated

View License

Like Matlab's saveas.m, but better:

   - Print figures as pdf in their correct dimensions (and not on A4 paper like Matlab does).
   - If you prefer, you can specify the size of the printed pdf, independent of its size on screen.
   - Optionally increase line thickness and font size for better readability.
   - Optionally set figure background color to transparent for use in presentations.

Example:

figure('Name','A sine');
plot(sin(linspace(0,2*pi,100)));
saveaspdf; % Saves 'A sine.pdf' on your Desktop

Comments and Ratings (5)

Matt Smith

Well done!! The function worked perfectly until I had a black background with white line art. This simple fix will always print it as it's shown in the figure.

I'd suggest adding this line:

set(h,'InvertHardCopy','off');

Shahab

Shahab (view profile)

Shatrughan

Thanks a millions !! worked perfectly...

Laurent S

Laurent S (view profile)

@Shatrughan: yes, this is possible using the global SAVEASPDF_PATH (type "help saveaspdf" for more options). For example you can do something like this:

global SAVEASPDF_PATH SAVEASPDF_SCALEFONTSIZE;
SAVEASPDF_PATH = 'C:\';
SAVEASPDF_SCALEFONTSIZE = 3;
plot(sin(linspace(0,2*pi,100)));
saveaspdf('A sine'); % Saves 'A sine.pdf' to C:\

Shatrughan

Hi..

This is really nice and saving beautiful figures..just one comment/question..is it somehow possible to save the figures at a desired location using this?..kindly enlighten me..
thanks..

MATLAB Release
MATLAB 7.12 (R2011a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video