Clear Filters
Clear Filters

How to set the proper papersize?

203 views (last 30 days)
Mr M.
Mr M. on 9 Nov 2015
Commented: Mr M. on 9 Nov 2015
I would like to use: figure('units','normalized','outerposition',[0 0 1 1]); to see my figures in the largest size on my screen. But after that I want to save it in a pdf format, but with a proper paper size, which is do not needlesly too big. For example on my screen: set(gcf,'PaperPositionMode','auto','papersize',[24 16]); is enough but too big. My question is how to calculate or get the proper number instead of [24 16] on an arbitrary screen automatically?

Answers (1)

Walter Roberson
Walter Roberson on 9 Nov 2015
You should set the figure PaperUnits property to indicate the scale you wish to use.
It is not possible to set a single paper size that will automatically adjust to all screens that are used to read the PDF.
If you want to set it to match the size of the figure that is being used, then set the figure Units property to be the same as the PaperUnits that you will be using, then get() the figure Position property; the last two components of that will be the width and height.
oldunits = gcf('Units');
set(gcf, 'PaperUnits', 'cm', 'Units', 'cm');
figpos = get(gcf, 'Position');
set(gcf, 'PaperSize', figpos(3:4), 'Units', oldunits);
  1 Comment
Mr M.
Mr M. on 9 Nov 2015
I want to use fullscreen figure window, but I dont want to restrict the ratio. Therefore it is possible to have a blank margin. After that I want to save the cropped figure into the pdf, and see the same textsize (in the pdf document) and everything else as shown on the screen.

Sign in to comment.

Categories

Find more on Problem-Based Optimization Setup in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!