2022.1

Table Of Contents
Put the number of the first page in the range in the section's background.start field and the last
page in background.end.
The following script sets the page range from 2 to 5:
merge.template.contexts.PRINT.sections['Policy'].background.start =
2;
merge.template.contexts.PRINT.sections['Policy'].background.end =
5;
Setting a page range automatically sets background.allPages to false (see "background" on
page1487).
On the other hand, when you first define a page range and then set background.allPages to
true, this disables the page range.
Tip
You could use the resource() function to check the number of pages or for example
the page height and width before setting it as a background (see "resource()" on
page1476).
Example
This scripts sets a background on a Print section using absolute positioning.
var activeSection = merge.template.contexts.PRINT.sections['Section
1'];
activeSection.background.source = BackgroundResource.RESOURCE_PDF;
activeSection.background.url = "images/somepage.pdf";
activeSection.background.position = MediaPosition.ABSOLUTE;
activeSection.background.left = "10mm";
activeSection.background.top = "10mm";
You could replace the last three lines of the previous script by the following line to scale the
Print section background to Media size:
activeSection.background.position = MediaPosition.FIT_TO_MEDIA;
Page 965