How to print a figure as a PDF, that has the same size of my figure (or, how to resize the PDF according to my figure dimensions)?
5 views (last 30 days)
Show older comments
How to print a figure as a PDF, that has the same size of my figure (or, how to resize the PDF according to my figure dimensions)?
In other words, how can I get rid of the upper and lower white margins in the following printed PDF?
% create a figure with "subtightplot"
subplot = @(m,n,p) subtightplot (m, n, p, [0.001 0], [0.01 0.01], [0.01 0.01]);
fig = figure('position',[700 100 700 1200],'Color',[1 1 1])
hold on
for i = 1 : 6
subplot(2,3,i);
end
hold off
% print the figure as PDF
fig.Units = 'centimeters'; % set figure units to cm
fig.PaperUnits = 'centimeters'; % set pdf printing paper units to cm
fig.PaperSize = fig.Position(3:4); % assign to the pdf printing paper the size of the figure
path = ( '/Users/Donald/.../' ); % where to print my figure
print (fig(:), '-dpdf','-loose','-opengl','-r600', [path, 'fig'] )
This is the resulting PDF, where you can clearly see the upper and lower white margins that I would like to get rid of:
3 Comments
Luca Ferro
on 7 Mar 2023
doesn't this have basically the same solution of what you already asked here? Crop white margins in a PDF file - MATLAB Answers - MATLAB Central (mathworks.com)
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Printing and Saving 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!