2019.1

Table Of Contents
Positioning, scaling and rotating the background
After a background has been selected, it can be positioned, scaled and rotated, using
properties of the background object; see "background" on page1296.
To position the background, for example, set the section's background.position:
activeSection.background.position = MediaPosition.FIT_TO_MEDIA;
For all possible positions, see "MediaPosition" on page1309.
Setting a page range in script
When a PDF that serves as a dynamic section background has multiple pages, you can specify
a range of pages to be used, in a control script.
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
page1296).
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 page1287).
Example
This scripts sets a background on a Print section using absolute positioning.
Page 837