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.
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.
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:
-
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.
-
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 OL Connect). 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).
The second most important object in a Post Pagination Script, just like in a Control Script, is a section
(see section).
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:
-
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. If needed, a Post Pagination Script can change the sheet configuration and re-paginate the section (see paginate().
-
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 Print Content Item in the Connect database (see contentitem). Custom properties can be utilized for further processing in a Workflow configuration with the Retrieve Items task. The Retrieve Items task retrieves custom properties along with the base record information (see Retrieve Items in Workflow's Online Help).
Adding a Post Pagination Script
To add a Post Pagination Script:
-
On the Scripts pane at the bottom left, click the black triangle on the New button and click Post Pagination Script. The new script appears in the Post Pagination folder.
-
Double-click the new script to open it. The script editor appears.
-
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.
-
Write the script. If you are not familiar with scripting, see Writing your own scripts.
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.