Main Content

mlreportgen.dom.PDFPageFooter class

Package: mlreportgen.dom

Page footer definition for PDF document

Description

Add a footer to the first page of a layout or to odd pages, even pages, or both.

The mlreportgen.dom.PDFPageFooter class is a handle class.

Creation

Description

pdfFooter = PDFPageFooter() creates an empty page footer based on the default PDF template.

example

pdfFooter = PDFPageFooter(pageType) creates a page footer for the specified type of page, that is, odd, even, or first, based on the default PDF template.

pdfFooter = PDFPageFooter(pageType,templatePath) creates a page footer based on the specified template.

pdfFooter = PDFPageFooter(pageType,templatePath,docPartTemplateName) creates a page footer for the specified type of page, based on the specified document part template in the specified template.

pdfFooter = PDFPageFooter(pageType,templateSrc,docPartTemplateName) creates a page footer for the specified type of page, based on the specified document part template from the specified source. The source can be a document or a document part.

Input Arguments

expand all

Type of pages the footer appears on, specified as one of these values:

  • default — Footer for odd pages of the section, even pages if you do not specify an even-page footer, and first page if you do not specify a first-page footer.

  • first — Footer for first page of a section.

  • even — Footer for even pages of a section.

For example, to make different footers appear on odd pages and on even pages, define two footers. Set pageType to default for one and to even for the other.

Full path of footer template, specified as a character vector.

Name of this part’s template if it is stored in a template specified by the templatePath or templateSrc argument, specified as a character vector.

Document or document part object whose template contains the template for this document part, specified as an mlreportgen.dom.Document object for a document or an mlreportgen.dom.DocumentPart object for a document part.

Properties

expand all

Children of this document element, specified as an array of DOM objects. This property is read-only.

This property does not apply to page footers.

This read-only property is the hole ID of the current hole in this document.

Type of the current template hole, specified as 'Inline' or 'Block'.

  • An inline hole is for document elements that a paragraph element can contain: Text, Image, LinkTarget, ExternalLink, InternalLink, CharEntity, AutoNumber.

  • A block hole can contain a Paragraph, Table, OrderedList, UnorderedList, DocumentPart, or Group.

ID for this document element, specified as a character vector or string scalar. The DOM generates a session-unique ID when it creates the document element. You can specify your own ID.

Attributes:

GetAccess
public
SetAccess
public
NonCopyable
true

Data Types: char | string

Type of page on which the footer appears, specified as one of these values:

  • default — Footer for odd pages of the section, even pages if you do not specify an even-page footer, and first page if you do not specify a first-page footer.

  • first — Footer for first page of a section.

  • even — Footer for even pages in a section.

To have a footer appear on odd pages and on even pages, define two footers, one with pageType set to default and the other with pageType set to even.

Parent of this document element, specified as a DOM object. This property is read-only.

Attributes:

GetAccess
public
SetAccess
private
NonCopyable
true

Tag for this document element, specified as a character vector or string scalar.

The DOM generates a session-unique tag as part of the creation of this object. The generated tag has the form CLASS:ID, where CLASS is the object class and ID is the value of the Id property of the object. Specifying your own tag value can help you to identify where an issue occurred during document generation.

Attributes:

GetAccess
public
SetAccess
public
NonCopyable
true

Data Types: char | string

Full path to the template to use for this footer, specified as a character vector.

Methods

expand all

Examples

collapse all

This example defines first, even, and odd page footers in a PDF document. It inserts a page number in each footer, using a different alignment for each page type.

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

% Create page footer objects for each type of page
% Assign a matrix of page footer objects to the current page layout
firstfooter = PDFPageFooter('first');
evenfooter = PDFPageFooter('even');
oddfooter = PDFPageFooter('default');
d.CurrentPageLayout.PageFooters = [firstfooter,evenfooter,oddfooter];

% Add title to first page footer
p = Paragraph('My Document Title');
p.HAlign = 'center';
append(d.CurrentPageLayout.PageFooters(1),p);

% Add page number to even page footer
% Align even page numbers left
pg2 = Page();
p2 = Paragraph();
p2.HAlign = 'left';
append(p2,pg2);
append(d.CurrentPageLayout.PageFooters(2),p2);

% Add page number to odd page footer
% Align odd page numbers right
pg3 = Page();
p3 = Paragraph();
p3.HAlign = 'right';
append(p3,pg3);
append(d.CurrentPageLayout.PageFooters(3),p3);

% Create several pages.
p = Paragraph('Hello World');
append(d,p);
p = Paragraph('Another page');
p.Style = {PageBreakBefore(true)};
append(d,p);
append(d,clone(p));

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

Version History

Introduced in R2016a