skip to main content
Charts > Programmer's documentation > The generic printing framework > The printing framework > The header and footer classes
 
The header and footer classes
To manage page headers and footers, the printing framework also contains two additional subclasses of IlvPrintableObject: IlvHeader and IlvFooter. Although these two classes are subclasses of the IlvPrintableObject, you do not add them to the page like other printable objects. The header and footer are common to all pages of a document, and thus are set on the instance of the IlvDocument class.
Here are the methods of the class IlvPrintableDocument to set a header or a footer:
 
public void setFooter(IlvFooter footer)
public IlvFooter getFooter()
 
public void setHeader(IlvHeader header)
public IlvHeader getHeader()
The IlvHeader and IlvFooter classes are very similar. A header or footer is defined by three text sections. Each section can have a specified font.
Here is an example of a header:
Example of a header
Each of the three text sections of a header or footer can contain the text that you specify in the constructor of the object. For the header shown in Example of a header it would be:
 
new IlvHeader("7/12/02", "Printing demo", "Page 1");
Since the header and footer are defined on the document, you should not specify the page number as in the previous example. The IlvHeader and IlvFooter classes provide a certain number of keys that will be translated to values from the document, when the document is printed.
The list of keys that you can use is as follows:
*static String AuthorKey - The key for the author.
*static String DateKey - The key for the date.
*static String FileKey - The key for the file name.
*static String PageKey - The key for the page number.
*static String PagesKey - The key for the number of pages in the document.
*static String TimeKey - The key for the printing time
To create the header in Example of a header, use the following new statement:
 
new IlvHeader(IlvHeader.DateKey, "Printing demo", "Page " + IlvHeader.PageKey)
NOTE The printing framework provides a page dialog box that also allows you to change the header and footer of a document.

Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.