2021.2

Table Of Contents
Example
The following script adds an image called 'dog.jpg' to the content of the template if the image
can be found in the template's resources:
const image = merge.template.images.find(image => image.name == 'dog.jpg');
if (image) {
results.after(`<img src=${image.path}>`);
}
masterpage
The masterpage object is used to set a Master Page's header and footer or to replace its entire
HTML body. It can only be accessed in Control Scripts (see "Control Scripts" on page913 and
"Control Script API" on page1405). Trying to access it in another type of script will result in an
error.
Note that Master Pages are only used in a Print context (see "Master Pages" on page506).
In script, Master Pages are retrieved via the masterpages Array which contains all Master
Pages in the current template (see "template" on page1436).
For example: var myMasterpage = merge.template.masterpages["Master page 1"];.
Functions and fields
Field Type Description
"html()" on
page1434
Gets or sets the HTML of the body element.
"margins" on
page1463
Margins Allows to set the header and footer of a Master Page, using
a Measurement string, for example: "2in" (this sets a margin
to two inches).
Page 1311