Documentation

mlreportgen.dom.PDFPageLayout class

Package: mlreportgen.dom

Page format and layout for PDF document section

Description

Use an mlreportgen.dom.PDFPageLayout object to define the page format, headers, and footers of a PDF document section.

Construction

PageLayoutObj = PDFPageLayout() creates an empty document page layout object.

Output Arguments

expand all

PageLayoutObj — Page layout objectmlreportgen.dom.PDFPageLayout object

Page format and layout for a PDF document section, returned as an mlreportgen.dom.PDFPageLayout object.

Properties

expand all

ChildrenChildren of this objectcell array of objects

This read-only property lists child elements of this object.

CustomAttributesCustom attributes of document elementarray of mlreportgen.dom.CustomAttribute objects

The output format must support the custom attributes of this document element.

FirstPageNumberNumber of first page in sectioninteger

Number of the first page in a section, specified as an integer.

IdID for document elementstring

A session-unique ID is generated as part of document element creation. You can specify an ID to replace the generated ID.

PageFootersPage footers for this layoutarray of mlreportgen.dom.PDFPageFooter objects

You can define up to three page footers for a layout, one each for:

  • The first page of the section

  • Even pages

  • Odd pages

PageHeadersPage headers for this layoutarray of mlreportgen.dom.PDFPageHeader objects

You can define up to three page headers for a layout, one each for:

  • The first page of the section

  • Even pages

  • Odd pages

PageMarginsMargin sizes for this layoutmlreportgen.dom.PageMargins object

Margin sizes for this layout, specified as an mlreportgen.dom.PageMargins object.

PageNumberFormatType of page numbering to use'a' | 'A' | 'i' | 'I' | 'n' | 'N'

Type of page numbering to use, specified as one of these values:

  • 'a' — Lowercase alphabetic.

  • 'A' — Uppercase alphabetic.

  • 'i' — Lowercase roman numerals.

  • 'I' — Uppercase roman numerals.

  • 'n' or 'N' — Numeric page numbers.

PageSizeSize and orientation of pages in this layoutmlreportgen.dom.PageSize object

Size and orientation of pages in this layout, specified as an mlreportgen.dom.PageSize object.

ParentParent of document elementDOM object

This read-only property lists the parent of this document element.

SectionBreakSection break options'Next Page' | 'Odd Page' | 'Even Page'

Option to create a section break for this layout, specified as one of these values:

  • 'Next Page'— Start the section on the next page.

  • 'Odd Page'— Start the section on an odd page.

  • 'Even Page'— Start the section on an even page.

StyleFormats to apply to layoutarray of format objects

Formats to apply to this layout, specified as an array of format objects. The formats you specify using this property override the same formats defined by the style applied with the StyleName property. Formats that do not apply to a page layout are ignored.

TagTag for document elementstring

Tag for document element, specified as a string.

A session-unique ID is generated as part of document element creation. The generated tag has the form CLASS:ID, where CLASS is the class of the element and ID is the value of the Id property of the object. You can specify a tag to replace the generated tag.

For example, to make it easier to identify where an issue occurred during document generation, you can specify your own tag value.

Examples

expand all

Change Page Margins of a Document Section

Create a PDF report using the default template. Open the document and assign the CurrentPageLayout property to a variable. Change the left and right margins for this layout.

import mlreportgen.dom.*;
d = Document('mydoc','pdf');

open(d);
s = d.CurrentPageLayout;
s.PageMargins.Left = '2in';
s.PageMargins.Right = '2in';
p = Paragraph('Hello World');
append(d,p);

close(d);
rptview(d.OutputPath);

Introduced in R2016a

Was this topic helpful?