2020.1

Table Of Contents
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
page887). 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879 and
"Control Script API" on page1355. If you don't know how to write scripts, see "Writing your own
scripts" on page843.
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 (see "section" on page1400),
but they cannot call the section functions clone(), addBefore() and addAfter(), which means
you cannot clone a clone, or insert a clone before/after another clone.
Note that with multiple clones, the next clone is always added after the previous clone.
With addBefore(), the code original.addBefore(clone1); original.addBefore(clone2); will
result in "clone1, clone2, original".
With addAfter() the code original.addAfter(clone1); original.addAfter(clone2); results
in "original, clone1, clone2".
Renaming a clone
By default, clones receive the name of their source section with a "Clone {unique identifier}"
suffix, for example:
Source: "Section 1"
Clone Name: "Section 1 Clone 71c3e414-fdf3-11e8-8eb2-f2801f1b9fd1"
Use the name property to assign another name to the cloned section, for example:
clone.name = "my_section_clone";
Just like section names, the clone's name should be unique - within the scope of a single
record, that is; across records, the same name can be used.
When two clones get the same name in the same record, one of the clones may no longer be
Page 890