1.8

Table Of Contents
Dynamically adding sections (cloning)
This topic explains how to clone a section in a Control Script, Print sections can be cloned, so
that a document can have a dynamic number of sections, based on data. This is particularly
useful when the record set defines one or more PDFs (e.g. insurance policies) per recipient.
Via a Control Script, for each PDF a section can be cloned and each clone can be given one of
the PDFs as background (see "Control Script: Setting a Print section's background" on
page288). For each page in the PDF, a page will be added to the section.
For information about Control Scripts in general, see "Control Scripts" on page281 and
"Control Script API" on page559. If you don't know how to write scripts, see "Writing your own
scripts" on page260.
Cloning a section
To clone a section, first use the clone() function and then add the clone to the Print context
before or after a specific section, using addAfter() or addBefore():
var printSections = merge.template.contexts.PRINT.sections;
var clone = printSections["Section 1"].clone();
printSections["Section 1"].addAfter(clone);
Cloned sections have the same properties as normal sections, but they cannot call section
functions.
Note
Due to resource constraints, the number of unique clones that can be created throughout a job is
limited to around 20. A clone is considered unique if it has a different name. This is a rough
estimate; if the template is simple, up to 60 clones may be created.
The limit only applies to the amount of unique clones. There is no limit to the amount of clone()
function calls.
Renaming a clone
By default, clones receive the name of their source section with a "Clone {sequence}" suffix, for
example:
Source: "Section 1"
Clone Name: "Section 1 Clone 1"
Use the name property to assign the cloned section another name, for example:
Page 291