2021.2

Table Of Contents
Positioning the background of a Print section
These scripts both set the background of a Print section to the same PDF, but they position it
differently.
Using abolute positioning
var activeSection = merge.template.contexts.PRINT.sections['Section
1'];
activeSection.background.source = BackgroundResource.RESOURCE_PDF;
activeSection.background.position = MediaPosition.ABSOLUTE;
activeSection.background.left = "10mm";
activeSection.background.top = "10mm";
activeSection.background.url = "images/somepage.pdf";
Scaling to Media size
var activeSection = merge.template.contexts.PRINT.sections['Section
1'];
activeSection.background.source = BackgroundResource.RESOURCE_PDF;
activeSection.background.position = MediaPosition.FIT_TO_MEDIA;
activeSection.background.url = "images/somepage.pdf";
See also: "BackgroundResource" on page1438, "MediaPosition" on page1442 and "Control
Script: Setting a Print section's background" on page922.
Cloning Print sections
For background information on cloning Print sections, see: "Dynamically adding sections
(cloning)" on page924.
Cloning a section based on the number of records in a detail table
This script creates as many clones of a section as there are records in a detail table. It assigns
the new sections a unique name.
var printSections = merge.template.contexts.PRINT.sections;
var numClones = record.tables['detail'].length;
for( var i = 0; i < numClones; i++){
var clone = printSections["Section 1"].clone();
clone.name = "my_section_clone_" + i;
printSections["Section 1"].addAfter(clone);
}
Page 1425