How to add images or logos into PDF/DOCX reports generated through Simulink Test Manager

9 views (last 30 days)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 24 Jan 2025
Edited: MathWorks Support Team on 4 Feb 2025
Simulink Test Manager uses MATLAB Report Generator to generate PDF/DOCX reports. You can add images or logos to the same, using the following:
For DOCX reports,
                Note: You can easily add images/logos to the template. See the section about adding images in the above link.
  • Then, you can generate your test reports using the template created in the previous step. To get instructions on how to generate reports using a template, run the following command in MATLAB R2019b:
web(fullfile(docroot, 'sltest/ug/create-a-test-results-report.html'))
For PDF/HTML reports,
  • To create a PDF template, follow the instructions by executing this command in MATLAB R2019b:
web(fullfile(docroot, 'rptgen/ug/create-an-html-or-pdf-template.html'))
  • For adding holes to the template, refer to the documentation by running this command in MATLAB R2019b:
web(fullfile(docroot, 'rptgen/ug/add-holes-in-an-html-template.html'))
There is also an example PDF template, 'sltestPDFReportTemplateExample.pdftx', in the help\toolbox\sltest\examples folder (a DOCX template also exists there). To add an image to this template, do the following:
        1. Copy the template file to a working directory.
2. Unzip the template with this command:
>> unzipTemplate('sltestPDFReportTemplateExample.pdftx');
        This creates a folder named 'sltestPDFReportTemplateExample'.
3. Copy the image you want to insert into the sltestPDFReportTemplateExample/images folder.
4. Open the file sltestPDFReportTemplateExample/root.html. You should see some holes already inserted in the report.
5. Wherever you want the image, insert an HTML "img" element. You can make other changes to the root.html file using HTML.
<img src="images/myImageFile.png"></img>
        6. After all modifications to the template file, zip the template files back into a PDFTX file:
>> zipTemplate('myCustomTemplate.pdftx', 'sltestPDFReportTemplateExample');
        7. Make sure to use the new template for report generation.
Please follow the link below to search for the required information regarding the current release:

More Answers (0)

Categories

Find more on Results, Reporting, and Test File Management in Help Center and File Exchange

Tags

No tags entered yet.

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!