2021.1

Table Of Contents
3. Change the name of the script so that it reflects what the script does.
Note
Scripts can only have the same name when they are not in the same folder.
4. Write the script. If you are not familiar with scripting, see "Writing your own scripts" on
page867.
Note
Post Pagination Scripts run only when a Print section is previewed or outputted.
To verify the results of Post Pagination Scripts on a certain Master Page, preview the
Print section to which that Master Page is applied.
Creating a Table Of Contents
This topic explains how to create a multi-page, cross-section Table Of Contents (TOC) using a
Post Pagination Script.
For information about Post Pagination Scripts in general, see "Post Pagination Scripts" on
page919.
The basics of script-writing in the Designer are explained in the following topic: "Writing your
own scripts" on page867.
Step 1: Opening a Print template
Create or open a Print template.
Make sure to use HTML headings level 1 and level 2 (<h1> and <h2>) in your Print sections, if
you want to use the script sample that is given in Step 3.This script collects the text and page
numbers of these headings and puts them in the TOC.
To quickly change a paragraph into a Heading, place the cursor inside of it, or select the
paragraph (see: "Selecting an element" on page629). Then select the appropriate element,
either on the Format menu, or from the 'Element type' drop-down on the toolbar.
Of course, you could just as well create a table of contents using other heading levels, or even
other elements. In that case you'll have to adjust the script accordingly.
Page 921