MATLAB: How to print a MATLAB 7.7 (R2008b) GUIDE GUI so that it resizes accordingly to the paper size in the printer as specified by the Windows print dialog

MATLAB

I have a GUIDE GUI in MATLAB 7.7 (R2008b). I want to set the 'PaperSize' GUI property to be the dimensions specified in the Windows print dialog instead of having to hard coding a 'PaperSize'.
Hard coding a paper size causes the print out of the GUI figure to be cut-short if the 'PaperSize' property is larger than the actual paper. If the 'PaperSize' property is smaller than the actual paper, the print out will be too small on the page.
How can I get every GUI print out to be perfectly sized for every paper dimension?

Best Answer

The ability to avoid hard-coding the 'PaperSize' GUI property by setting its value to be the paper size specified in the Windows print dialog is not available in MATLAB 7.7 (R2008b).
A workaround is to print the GUIDE GUI to a PDF, which can then be printed on any size paper.
h = yourguidegui; % gets a handle to the GUIDE GUI figure
saveas(h,'test.pdf'); % Saves the figure to PDF