2022.2

Table Of Contents
Note: IftheEmailPDFPasswordScriptWizarddefinesapassword,andatemplatehasaCon-
trolScriptthatcreatesmultiplePDFattachments,alltheattachmentsaresecuredbythesame
passwordbydefault.UsingaControlScript,youcansetsetdifferentpasswordsforattachments;
see"ControlScript:SecuringPDFattachments"onpage849.
Positioning the background of a Print section
ThesescriptsbothsetthebackgroundofaPrintsectiontothesamePDF,buttheypositionitdif-
ferently.
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"onpage1294,"MediaPosition"onpage1296and"ControlScript:
SettingaPrintsection'sbackground"onpage845.
Cloning Print sections
ForbackgroundinformationoncloningPrintsections,see:"Dynamicallyaddingsections(cloning)"on
page846.
Cloningasectionbasedonthenumberofrecordsinadetailtable
Thisscriptcreatesasmanyclonesofasectionastherearerecordsinadetailtable.Itassignsthenew
sectionsa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 1285