MATLAB Report Generator – Edit PDF page margins in sections.
Hi,
I built a pdf report using mlreportgen.report.Report() function. I want to edit heading format e.g. margin size around the pages. I found examples but the function Document() is used and I’d rather keep Report() function. I also found example using Report() but I can only edit title page and table of content format. I can’t modify what’s inside a section for instance.
From what I read, I should edit the pdf template to achieve that. But I can’t find an easy way to edit *.pdftx files. I unzipped it and played with docpart_templates.html and root.html but I’m really not a html expert. Is there a tool to edit the template easily or is there a way to modify properties of chapter, section, paragraph, etc. using code in my script?
Here’s my code. The template ‘Default_PDF_Template.pdftx’ is a copy of the built-in template "Default PDF Template" I took in Report Explorer. I assume the template can be edited in Report Explorer but I can figure out how.
Thanks in advance!
import mlreportgen.report.*
import mlreportgen.dom.*
% Create report
rpt = Report(‘MyReport’, ‘pdf’,’Default_PDF_Template.pdftx’);
open(rpt);
% Add a title page
append(rpt, TitlePage(Title=’My Report’));
% Add table of content
toc = TableOfContents;
append(rpt, toc);
% Create all sections
sect_1 = Section(Title=’Simulation Results’);
sect_1_1 = Section(Title=’Signal Description’);
sect_2 = Section(Title=’Parameters’);
% Append sections
append(sect_1, sect_1_1);
append(rpt, sect_1);
append(rpt, sect_2);
% Close and show report
close(rpt);
rptview(rpt);Hi,
I built a pdf report using mlreportgen.report.Report() function. I want to edit heading format e.g. margin size around the pages. I found examples but the function Document() is used and I’d rather keep Report() function. I also found example using Report() but I can only edit title page and table of content format. I can’t modify what’s inside a section for instance.
From what I read, I should edit the pdf template to achieve that. But I can’t find an easy way to edit *.pdftx files. I unzipped it and played with docpart_templates.html and root.html but I’m really not a html expert. Is there a tool to edit the template easily or is there a way to modify properties of chapter, section, paragraph, etc. using code in my script?
Here’s my code. The template ‘Default_PDF_Template.pdftx’ is a copy of the built-in template "Default PDF Template" I took in Report Explorer. I assume the template can be edited in Report Explorer but I can figure out how.
Thanks in advance!
import mlreportgen.report.*
import mlreportgen.dom.*
% Create report
rpt = Report(‘MyReport’, ‘pdf’,’Default_PDF_Template.pdftx’);
open(rpt);
% Add a title page
append(rpt, TitlePage(Title=’My Report’));
% Add table of content
toc = TableOfContents;
append(rpt, toc);
% Create all sections
sect_1 = Section(Title=’Simulation Results’);
sect_1_1 = Section(Title=’Signal Description’);
sect_2 = Section(Title=’Parameters’);
% Append sections
append(sect_1, sect_1_1);
append(rpt, sect_1);
append(rpt, sect_2);
% Close and show report
close(rpt);
rptview(rpt); Hi,
I built a pdf report using mlreportgen.report.Report() function. I want to edit heading format e.g. margin size around the pages. I found examples but the function Document() is used and I’d rather keep Report() function. I also found example using Report() but I can only edit title page and table of content format. I can’t modify what’s inside a section for instance.
From what I read, I should edit the pdf template to achieve that. But I can’t find an easy way to edit *.pdftx files. I unzipped it and played with docpart_templates.html and root.html but I’m really not a html expert. Is there a tool to edit the template easily or is there a way to modify properties of chapter, section, paragraph, etc. using code in my script?
Here’s my code. The template ‘Default_PDF_Template.pdftx’ is a copy of the built-in template "Default PDF Template" I took in Report Explorer. I assume the template can be edited in Report Explorer but I can figure out how.
Thanks in advance!
import mlreportgen.report.*
import mlreportgen.dom.*
% Create report
rpt = Report(‘MyReport’, ‘pdf’,’Default_PDF_Template.pdftx’);
open(rpt);
% Add a title page
append(rpt, TitlePage(Title=’My Report’));
% Add table of content
toc = TableOfContents;
append(rpt, toc);
% Create all sections
sect_1 = Section(Title=’Simulation Results’);
sect_1_1 = Section(Title=’Signal Description’);
sect_2 = Section(Title=’Parameters’);
% Append sections
append(sect_1, sect_1_1);
append(rpt, sect_1);
append(rpt, sect_2);
% Close and show report
close(rpt);
rptview(rpt); report generator, pdf template, pdf report MATLAB Answers — New Questions