Compiled report generator script fails.

5 views (last 30 days)
Michael
Michael on 23 Jan 2025
Commented: Michael on 28 Jan 2025
I am receiving an error in a compiled script for report generator.
Here is the script:
makeDOMCompilable();
import mlreportgen.report.*
import mlreportgen.dom.*
rpt = Report('Test','pdf');
%open(rpt);
% titlepage
%I = imread(img);
%imshow(I);
tp = TitlePage;
%location = pwd;
tp.Title = 'Just a Test';
tp.Image = which(strcat('duel.jpg'));
%tp.Author = Analyst();
tp.Publisher = 'Mike Fisher';
tp.PubDate = date();
tp.Subtitle = 'GTG';
add(rpt,tp);
add(rpt,LineBreak);
close(rpt);
rptview(rpt);
Runs fine in the command window. Compile it and run, get this error:
Error using mlreportgen.dom.Image
Invalid image type: .
Error in mlreportgen.report.TitlePage/getImageReporter
Error in mlreportgen.report.TitlePage/getImag
Error in mlreportgen.report.ReportForm/fillHole
Error in mlreportgen.report.TitlePage/processHole
Error in mlreportgen.report.ReportForm/fillForm
Error in mlreportgen.report.ReporterBase/getDocumentPart
Error in mlreportgen.report.ReporterBase/getImpl
Error in mlreportgen.report.internal.LockedForm.add
Error in mlreportgen.report.ReportBase/append
Error in mlreportgen.report.ReportBase/add
Error in JTest (line 28)

Answers (1)

Kojiro Saito
Kojiro Saito on 24 Jan 2025
It seems that duel.jpg is not included in the compiled script, so tp.Image is not an image format then add(rpt,tp) gives an error.
You need to add duel.jpg in "Files required for your application to run" of Application Compiler or add "-a duel.jpg" option in mcc command.
  2 Comments
Michael
Michael on 28 Jan 2025
That does not solve the problem. The report generator must be able to look at several different file folders and pick a particular image (all named the same) from a specific folder. I cannot compile the images with the application, they change.
Michael
Michael on 28 Jan 2025
Further efforts produce not working when running the stand alone app, but launching Command Prompt and running from within Command Prompt does work.

Sign in to comment.

Categories

Find more on MATLAB Report Generator in Help Center and File Exchange

Products


Release

R2024b

Community Treasure Hunt

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

Start Hunting!