2022.1

Table Of Contents
The basics of script-writing in the Designer are explained in the following topic: "Writing your
own scripts" on page918.
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.
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 change the sheet configuration and 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 page939). 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 page1509).
The second most important object in a Post Pagination Script, just like in a Control Script, is a
section (see "section" on page1515).
What to use a Post Pagination Script for
After all Print sections have been paginated, Post Pagination Scripts may search through the
rendered document and collect information about elements (for instance, which page they
reside on) and sections (for instance, whether they are enabled). With this information, a Post
Pagination Script can do two things:
l Modify the output. The script may modify the output of a section. It could, for example,
use information like page numbers to create a Table Of Contents (TOC), as explained in
the topic: "Creating a Table Of Contents" on the facing page. If needed, a Post Pagination
Script can change the sheet configuration and re-paginate the section (see "paginate()"
on page1525.
l Add information to the Connect database. The script may add production information,
such as the page, size or position of elements after a merge, as custom properties to a
Page 971