Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

mlreportgen.dom.PDFPageFooter class

Package: mlreportgen.dom
Superclasses:

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.

Construction

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

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 a mlreportgen.dom.DocumentPart object for a document part.

Output Arguments

expand all

Page footer for a PDF document, returned as an mlreportgen.dom.PDFPageFooter object.

Properties

expand all

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

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. The DOM generates a session-unique ID when it creates the document element. You can specify your own ID.

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.

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

Tag for document element, specified as a character vector.

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.

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

Methods

Use DocumentPageFooter methods as you use the corresponding Document methods.

Method

Purpose

append

Append one of these DOM objects to the footer:

  • CustomElement

  • FormalTable

  • Group

  • ExternalLink

  • Image

  • InternalLink

  • OrderedList

  • Paragraph

  • RawText

  • Table

  • Text

  • UnorderedList

close

Close the footer.

fill

Fill the template hole.

moveToNextHole

Move to the next template hole.

open

Open the footer.

Examples

expand 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);

Introduced in R2016a

Was this topic helpful?