Print an image with a fixed size

Hello everyone,
I would like to print an emf-file with a fixed size of 21x12cm:
hFig = figure;
set(hFig, 'PaperUnits', 'centimeters');
set(hFig, 'PaperSize', [21 12]);
print(hFig,'-dmeta','testfile');
But the created image has only the size of 13.4x10.1cm! Why it doesn't work?
Many thanks in advance for your help!

 채택된 답변

Patrick Kalita
Patrick Kalita 2011년 9월 27일

0 개 추천

You should use the 'PaperPosition' property to adjust the output size, not 'PaperSize'. However, even if you make that change, you'd find that it still doesn't work. There's a bug report about it: http://www.mathworks.com/support/bugreports/231161.
While the print command doesn't give you the correct size when exporting to an EMF-file, the File -> Export Setup... dialog will get it right. If you don't have too many figures to export, that might be something check out.

댓글 수: 1

Rudolf
Rudolf 2011년 9월 27일
Hello Patrick, Thank you for the hints!
But even if I use Export Setup... dialog I get wrong size image (19.0 x 10.9 cm). The possible reason is the resolution of my desktop: 106 dpi instead of default value 96 dpi.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Rudolf
Rudolf 2011년 9월 27일

0 개 추천

Btw, I found another workaround:
style = hgexport('factorystyle');
style.Width = '21';
style.Height = '12';
style.Units = 'centimeters';
style.ApplyStyle = '1';
hgexport(hFig,'-clipboard',style,'applystyle', true);
drawnow;
but there is still this issue with a desktop resolution...

카테고리

제품

Community Treasure Hunt

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

Start Hunting!

Translated by