MATLAB Report Generator: Get rid of top page margin

2 Ansichten (letzte 30 Tage)
Kevin
Kevin am 17 Nov. 2021
Beantwortet: Divyam am 5 Sep. 2024
Hi everyone,
I can get rid of left margin. But even setting
d.CurrentPageLayout.PageMargins.Top = '0.0in'
I still cannot get rid of top margin. This is my entire matlab code:
d = mlreportgen.dom.Document('mydoc.pdf', 'pdf');
open(d);
d.CurrentPageLayout.PageMargins.Top = '0.0in';
d.CurrentPageLayout.PageMargins.Bottom = '0.5in';
d.CurrentPageLayout.PageMargins.Left = '0.0in';
d.CurrentPageLayout.PageMargins.Right = '0.5in';
append(d, mlreportgen.dom.Paragraph('Load Test Information'));
close(d);
Kevin

Antworten (1)

Divyam
Divyam am 5 Sep. 2024
Hi @Kevin,
To remove the blank space at the top of your document, set the Header margin to '0.0in' and adjust the top margin accordingly.
% Generate a test PDF
d = mlreportgen.dom.Document('test_doc', 'pdf');
open(d);
% Set the Header margin to '0.0in'
d.CurrentPageLayout.PageMargins.Header = '0.0in';
% Append the paragraph to the PDF
append(d, mlreportgen.dom.Paragraph('Load Test Information'));
close(d);

Kategorien

Mehr zu Testing Frameworks finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by