Add Page Numbers and Breaks

This section describes how to add the following page features to the PDF layout.

Add Page Numbers

To add page numbers, define a field in the layout where you want the page number to appear and enter an initial value in that field.

  1. Decide the position on the layout where you want the page number to be displayed.
  2. Create a placeholder field called @pagenum@.
  3. Enter a starting value for the page number in the Default field (Text Field Properties > Options tab). If the XML data includes a value for this field, then the start value that is assigned in the layout is overridden. If no start value is assigned, then it defaults to 1.

Add Page Breaks

You can define a page break in the layout to occur after a repeatable field.

To insert a page break after the occurrence of a specific field, add the following to the syntax in the Tooltip field of the Text Field Properties dialog:

page_break="yes"

For example:

<?rep_field="T1_G3", page_break="yes"?>

The following example demonstrates inserting a page break in a layout. The XML sample contains salaries of employees by department:

<?xml version="1.0"?>
<ROOT>
  <LIST_G_DEPTNO>
    <G_DEPTNO>
      <DEPTNO>10</DEPTNO>
      <LIST_G_EMPNO>
        <G_EMPNO>
          <EMPNO>7782</EMPNO>
          <ENAME>CLARK</ENAME>
          <JOB>MANAGER</JOB>
          <SAL>2450</SAL>
        </G_EMPNO>
        <G_EMPNO>
          <EMPNO>7839</EMPNO>
          <ENAME>KING</ENAME>
          <JOB>PRESIDENT</JOB>
          <SAL>5000</SAL>
        </G_EMPNO>
        <G_EMPNO>
          <EMPNO>125</EMPNO>
          <ENAME>KANG</ENAME>
          <JOB>CLERK</JOB>
          <SAL>2000</SAL>
        </G_EMPNO>
        <G_EMPNO>
          <EMPNO>7934</EMPNO>
          <ENAME>MILLER</ENAME>
          <JOB>CLERK</JOB>
          <SAL>1300</SAL>
        </G_EMPNO>
        <G_EMPNO>
          <EMPNO>123</EMPNO>
          <ENAME>MARY</ENAME>
          <JOB>CLERK</JOB>
          <SAL>400</SAL>
        </G_EMPNO>
        <G_EMPNO>
          <EMPNO>124</EMPNO>
          <ENAME>TOM</ENAME>
          <JOB>CLERK</JOB>
          <SAL>3000</SAL>
        </G_EMPNO>
      </LIST_G_EMPNO>
      <SUMSALPERDEPTNO>9150</SUMSALPERDEPTNO>
    </G_DEPTNO>
    
    <G_DEPTNO>
      <DEPTNO>30</DEPTNO>
      <LIST_G_EMPNO>
        .
        .
        .   
        
      </LIST_G_EMPNO>
      <SUMSALPERDEPTNO>9400</SUMSALPERDEPTNO>
    </G_DEPTNO>
  </LIST_G_DEPTNO>
  <SUMSALPERREPORT>29425</SUMSALPERREPORT>
</ROOT>

Suppose the report requirement is to display the salary information for each employee by department as shown in the following figure:

To insert a page break after each department, insert the page break syntax in the Tooltip field for the SUMSALPERDEPTNO field as follows:

<?rep_field="T1_G3", page_break="yes"?>

The Text Field Properties dialog for the field is shown in the following figure.

For a break to occur, the field must be populated with data from the XML file.

The sample report with data is shown in the following figure:

The page breaks after each department.