1.7

Table Of Contents
Control Script: Page numbering
This topic explains how to write a Control Script that changes the page numbering in Print
sections. Note that when you add a Control Script, it already contains a script to make the page
numbering continue over all Print sections.
For information about Control Scripts in general, see "Control Scripts" on page570 and
"Control Script API" on page841. If you don't know how to write scripts, see "Writing your own
scripts" on page552.
How to change page numbering in a control script
A Control Script can make the page numbering continue over all Print sections or let it restart
on a section. This is done by setting the restartPageNumber field on a section to true or false.
For example: merge.template.contexts.PRINT.sections['Section 2'].restartPageNumber =
true;. (Also see "section" on page846 and "Control Script API" on page841.)
Page numbering starts with page 1 for each section. If for a section restartPageNumber is set to
false, that section will start with the page number following the last page of the previous
section.
Note that even if a section is not enabled (so it will not be outputted), its restartPageNumber flag
is still taken into account for composing the page number sequences.
By default, each section has restartPageNumber = false when the first control script runs.
Tip
If you are looking to create a table of contents, add a template script that uses the pageRef()
function. For an example, see "Creating a table of contents" on page832.
Examples
Restarting the page numbers several times
Assume that a template has four sections (of 1 page each) in the Print context and a Control
Script sets the page numbering as follows:
Page 574