# pagenumber element

Type: | Images and Specials
Attributes: | idref • size • type
See: | totalpages

The pagenumber tag prints the page number of an element. By default it prints the pagenumber for itself (ie. the current page), but the idref attribute may be set to print the page number for another element. This element is often used in the header or footer of a document. Like the totalpages tag, the Report Generator has to take a guess as to how many characters to allow for this element - this may be controlled by the size attribute.

A simple footer that prints the current and total number of pages.

    <head>
      <macrolist>
        <macro id="myfooter">
          <p align="center">
            Page <pagenumber/> of <totalpages/>
          </p>
        </macro>
      </macrolist>
    </head>
    <body footer="myfooter" footer-height="2em">

This shows the IDREF attribute to print the page of a named element

    <h1>Table of Contents</h1>
    <table>
      <tr><td>Chapter 1</td><td><pagenumber idref="chapter1"/></td></tr>
      <tr><td>Chapter 2</td><td><pagenumber idref="chapter2"/></td></tr>
    </table>

    <h1 id="chapter1">
    <p> Chapter 1 goes here </p>

    <h1 id="chapter2">
    <p> Chapter 2 goes here </p>

This shows how to print the current page in roman numerals

    <pagenumber type="lower-roman"/>