- Save the image as a jpg image.
- Rotate the image 90 degrees using the imrotate function--requires the MATLAB Image Processing Toolbox or your own rotate function (see image rotation examples)
- Save the rotated image.
- Wrap the rotated image in a DOM Image object.
- Save your report's current page layout.
- Append a landscape page layout to your report.
- Append the rotated image object to your report.
- Clone your original page layout.
- Append the cloned page layout to restore your report's original page layout.
Report Generator Image Rotation
2 views (last 30 days)
Show older comments
Hi, I'm trying to write a code which saves matlabfigures as jpg-images and imports it afterwards into the report content to create a PDF. My problem is that some of these images need to be rotated 90 degrees. I'm writing the code programatically not using the reportgenerator interface. Here is my the important part of my code:
saveas(gcf,'Daten/Report/Plot4.jpg');
Plot4_Image = Image('Daten/Report/Plot4.jpg');
Plot4_Image.Style = {ScaleToFit, PaperOrientation(Landscape)};
append(Report,Plot4_Image);
Of course this is throwing an error because there is no attibute Paperorientation for mlreportgen.dom.image.style but you get the idea what i wanna do. It semms like this should be a simple task but i just can't get the hang of it. I want the image to be rotated + 90° and fill a whole page in the PDF. I've looked into changing the orientation when the image is first saved as well but it seems like saveas has the default orientation portrait and i don't really wanna change the code of it because for all the other images portrait is fine.
Hope someone can help me!
Cheers Yannick
0 Comments
Answers (1)
Paul Kinnucan
on 14 Feb 2017
Rotating an image and printing it on a landscape page in your report is doable but not easy. Here is a recipe:
0 Comments
See Also
Categories
Find more on Images, Figures, Axes, Equations, MATLAB Code, and MATLAB Variables 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!