PD4ML provides 3 types of headers/footers.
- text-only
- html (PD4ML Pro)
- inline (PD4ML Pro)
The first 2 options are available by PD4ML Java API calls (or as JSP custom tags mapped to PD4ML API): i.e.
<pd4ml:footer> ->
pd4ml.setPageFooter(); 1. Text only (in such form can be used only in JSP):
<pd4ml:footer
pageNumberTemplate="page $[page] of $[total]"
titleAlignment="left"
pageNumberAlignment="right"
color="#008000"
initialPageNumber="1"
pagesToSkip="1"
fontSize="14"
areaHeight="18"/>
Java version:
PD4PageMark footer = new PD4PageMark();
footer.setPageNumberTemplate("page $[page] of $[total]");
footer.setTitleAlignment(PD4PageMark.LEFT_ALIGN);
footer.setPageNumberAlignment(PD4PageMark.RIGHT_ALIGN);
footer.setColor(new Color(0x008000));
footer.setInitialPageNumber(1);
footer.setPagesToSkip(1);
footer.setFontSize(14);
footer.setAreaHeight(18);
pd4ml.setPageFooter(footer);
2. HTML formatted footer (in such form can be used only in JSP)
<pd4ml:footer areaHeight="-1">
<font color="red"><i>page $[page] of $[total]</i></font>
</pd4ml:footer>
Java version:
PD4PageMark footer = new PD4PageMark();
footer.setHtmlTemplate("<font color=\"red\"><i>page $[page] of $[total]</i></font>");
footer.setAreaHeight(-1);
pd4ml.setPageFooter(footer);
areaHeight="-1" means
"autocompute" there
3. The third option,
inline footer, allows to define footer body in HTML/PHP document:
<pd4ml:page.footer>
footer: $[page] of $[total]
</pd4ml:page.footer>
The definition impacts all subsequent pages after the page, where the footer defined. A new appearance of the footer overrides previously defined one.
In order to define the footer for the first page, you need to place the definition immediately after <body> tag or before <html>.
Also you may explicitly define pages, where the footer needs to be applied:
<pd4ml:page.footer scope="1">
first page footer: $[page] of $[total]<br> <img src="img1.gif">
</pd4ml:page.footer>
<pd4ml:page.footer scope="2+">
footer: $[page] of $[total]<br>
<img src="img2.gif">
</pd4ml:page.footer>
<html>
<head>
...
The above defines different footers for the first page and for the rest of the pages (the second and others). Also "scope" understands "even", "odd" and "skiplast" modifiers. Example:
scope="2,5-10,even,skiplast"