File Exchange

image thumbnail

Adjust PDF page

version 1.0 (1.89 KB) by

MATLAB writes figures to PDF files as a full page. This function corrects that.



View License

By default, when writing a figure window to a PDF file, the figure's content is centered on an A4 or letter-sized page. This is not true for any other file format (EPS, TIFF, PNG, etc, where the bounding box of the resulting graphic, very sensibly, matches that of the figure window). This simple function sets the figure's PaperSize and PaperPosition properties so that the PDF file's bounding box matches that of the figure window.

<create a nice plot>
print -dpdf figure1.pdf

This function was created using Release 2011b, but should work for earlier releases also.

Comments and Ratings (1)

This is exactly what I needed. Thanks!

Such a shame that Matlab doesn't handle this sensibly by default.

MATLAB Release
MATLAB 7.13 (R2011b)

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

» Watch video

Win prizes and improve your MATLAB skills

Play today