How print image to landscape PDF with minimal margins?
29 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
David W Purcell
el 2 de Oct. de 2023
Comentada: David W Purcell
el 2 de Oct. de 2023
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')
0 comentarios
Respuesta aceptada
Akshat
el 2 de Oct. de 2023
Editada: Akshat
el 2 de Oct. de 2023
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.
Más respuestas (0)
Ver también
Categorías
Más información sobre Convert Image Type en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!