2022.2

Table Of Contents
Example
ThisscriptretrievestwoPrintsections.Then,dependingonavalueinthecurrentrecord,itenablesone
sectionortheother,sothatonlyoneofthetwosectionsappearsintheoutput.
var printSections = merge.template.contexts.PRINT.sections;
printSections['Section EN'].enabled = false;
printSections['Section FR'].enabled = false;
if(record.fields.Language === 'FR'){
printSections['Section FR'].enabled = true;
} else {
printSections['Section EN'].enabled = true;
}
ImageResource
TheImageResourceobjectrepresentsanimageresourceinatemplate.
Inscript,anImageResourceisretrievedviatheimagesArraywhichcontainsalistofallimage
resourcesthatareincludedinthecurrenttemplate(see"template"onpage1292).
Forexample:var myImage = merge.template.images[0];.
Functions and fields
Field Type Description
modified Number Timestampofthelastmodificationoftheimageresource,forexample:1566660504000.
name
String Thebasenameoftheimageresource,forexample:"cat.jpg".
path
String Thepathoftheimageresource,relativetothetemplate,forexample:"images/cat.jpg".
Example
Thefollowingscriptaddsanimagecalled'dog.jpg'tothecontentofthetemplateiftheimagecanbe
foundinthetemplate'sresources:
const image = merge.template.images.find(image => image.name == 'dog.jpg');
if (image) {
results.after(`<img src=${image.path}>`);
}
MediaPosition
InaControlScript,thepositionisanenumerationforthepositionofbackgroundresourcesfora
Printsection.Itisretrievedandsetviabackground.position.
Page 1296