Hello,
I am trying to create a figure that will eventually be "print"ed to pdf at a standard paper size. However, if I tried to create this figure when my screen resolution + screen dpi is insufficient to hold the full figure, I receive the following error upon invoking "print":
Warning: UI controls may not print or export properly because the output has been scaled. Setting the figure's
PaperPositionMode property to 'auto' may help.
And indeed the uicontrols do not output correctly on the resulting pdf. Following the advice and setting PaperPositionMode to 'auto' does not fix the problem, although it does change the way in which the output is incorrect.
It seems I would want to prevent matlab from automatically "scaling the output", but I cannot find how to do this. I understand that what I want will prevent me from viewing the full figure correctly on my screen, but I don't care because I ultimately want the printed pdf to be correct.
Alternatively, maybe I am misusing the "PaperPosition" and "PaperSize" properties of the figure?
Here is a minimal example to reproduce the warning, though it does not give an appreciation of what goes wrong with the ui control placement on the pdf (in my application I carefully place many uicontrols). In this example, I want a 20"x20" pdf, but it cannot be held in full on my screen, which is a 1920x1080 display with reported ScreenPixelsPerInch=96 to give 20"x11.25". In my real application, I want a 8.5"x11" (portrait), and I want it to work even if the screen is small (e.g., laptop with 720 pixels tall and typical screen dpi).
PaperSize = [21,21];
hFig = figure('Units','inches',...
'Position',[0,0,PaperSize],...
'PaperPosition',[0,0,PaperSize],...
'PaperSize',PaperSize,...
'PaperPositionMode','manual');
uicontrol(hFig,'Style','pushbutton','String','uicontrol element')
print('tmp.pdf','-dpdf','-r600');
Thanks in advance for any help.
Matlab version is 9.1.0.441655 (R2016b)