2018.2

Table Of Contents
}
}
Post Pagination Scripts
Post Pagination Scripts are run in a Print context after the content has been paginated.
Because they can search through the output of all Print sections, and modify Print sections (one
at a time), they may be used to create a Table Of Contents (TOC), as explained in the topic:
"Creating a Table Of Contents" on the next page.
This topic explains what a Post Pagination Script is and how to add it to a template.
The basics of script-writing in the Designer are explained in the following topic: "Writing your
own scripts" on page722.
What Post Pagination Scripts are
Post Pagination Scripts are a special kind of Designer script: they are applied to the output of
all sections in a Print context after the content has been paginated. They may collect
Post Pagination Scripts differ from Standard Scripts and Control Scripts in two ways:
l
Post Pagination Scripts run after all other scripts, more precisely: after the content has
been paginated. The pagination process applies page breaks to the content of a Print
section, adds Master Pages and sets the Media. A Post Pagination Script may query the
rendered document and collect information about elements (for instance, on which page
they reside on) and sections (for instance, whether they are enabled). If needed, a Post
Pagination Script can re-paginate a section.
l
Post Pagination Scripts only apply to the Print context. The output of other contexts is not
paginated.
Just like Standard Scripts, Post Pagination Scripts have a selector (see: "Selectors in
Connect" on page745). A selector selects parts of the content of a section and stores them in
the results object, so that they can be modified in the script (see "results" on page1192).
The second most important object in a Post Pagination Script, just like in a Control Script, is a
section (see "section" on page1196).
Page 766