As explained by @LewisNorton , you need to set the Paper*** properties of the shape. Below is an example of creating a PDF file with dimensions of 420 x 297 mm (size A3), where the margins between the graph and the borders of the file are 10 mm each (upper, lower, left, right).
%# centimeters units X = 42.0; %# A3 paper size Y = 29.7; %# A3 paper size xMargin = 1; %# left/right margins from page borders yMargin = 1; %# bottom/top margins from page borders xSize = X - 2*xMargin; %# figure size on paper (widht & hieght) ySize = Y - 2*yMargin; %# figure size on paper (widht & hieght) %# create figure/axis hFig = figure('Menubar','none'); plot([0 1 nan 0 1], [0 1 nan 1 0]), axis tight set(gca, 'XTickLabel',[], 'YTickLabel',[], ... 'Units','normalized', 'Position',[0 0 1 1]) %# figure size displayed on screen (50% scaled, but same aspect ratio) set(hFig, 'Units','centimeters', 'Position',[0 0 xSize ySize]/2) movegui(hFig, 'center') %# figure size printed on paper set(hFig, 'PaperUnits','centimeters') set(hFig, 'PaperSize',[XY]) set(hFig, 'PaperPosition',[xMargin yMargin xSize ySize]) set(hFig, 'PaperOrientation','portrait') %# export to PDF and open file print -dpdf -r0 out.pdf winopen out.pdf


Without a printer at hand, I use a virtual ruler to verify measurements; Just display the PDF file with your preferred view and set the zoom level to 100% (I use Sumatra PDF ). If you want to try it yourself, just keep in mind that some viewers (Adobe Reader) may use a custom DPI that does not match the default resolution in the system (mine at 96 pixels / inch).
Here you can see the bottom and left margins equal to 10mm . The same is true for the other two fields:

Please note that in the above example, I made an axial coating of the whole figure (without the gray area in the figure). By default, MATLAB leaves blank space for ticks, tags, headers, etc. This, of course, is different from the fields mentioned above, which I assume you already know :)