How print image to landscape PDF with minimal margins?

29 次查看(过去 30 天)
Hello,
I've read several examples here, but I can't quite get my image to print to PDF with minimal or no margins. I would like to maintain my aspect ratio (from a Canon SLR camera). I would like the page to be landscape orientation 11 inches wide by 8.5 inches tall. My output PDF is landscape, but the margins are too large. My code is below, but it doesn't quite achieve my goal. Thank you for any suggestions, DP
mf=figure;
imshow(thisImg);
set(mf, 'PaperOrientation','landscape');
set(mf, 'PaperUnits','Inches');
set(mf, 'PaperSize',[11 8.5]);
set(mf, 'PaperPosition', [0 0 11 8.5]);
%print('test','-dpdf','-fillpage') %didn't help
print('test','-dpdf')

采纳的回答

Akshat
Akshat 2023-10-2
编辑:Akshat 2023-10-2
I understand that you want to print image to landscape PDF with minimal margins while maintaining the aspect ratio. As you mentioned, you have already tried using the '-fillpage' option, but it did not help. To address this issue, you can try incorporating the following changes in the code snippet, which sets the 'PaperPositionMode' option for the figure and adjusts the 'Position' attribute for the axes.
mf = figure;
imshow(thisImg);
set(mf, 'PaperOrientation', 'landscape');
set(mf, 'PaperUnits', 'inches');
set(mf, 'PaperSize', [11 8.5]);
set(mf, 'PaperPositionMode', 'manual');
set(mf, 'PaperPosition', [0 0 11 8.5]);
set(gca, 'Position', [0 0 1 1]); % ensure the image fills the entire figure
print('test', '-dpdf', '-r0'); % use '-r0' for maximum resolution
In the above code, '-r0' format option is being leveraged to specify the screen resolution.
Have a look at the below references for better understanding
I hope this helps.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Convert Image Type 的更多信息

标签

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by