2022.2

Table Of Contents
Imagefileextensionsthatthesoftwarerecognizesare:AFP,BMP,EPS,GIF,JPG/JPEG,PCL,
PDF,PNG,PS,SVG,andTIF/TIFF.
Positioning, scaling and rotating the background
Afterabackgroundhasbeenselected,itcanbepositioned,scaledandrotated,usingpropertiesofthe
backgroundobject;see"background"onpage829.
Topositionthebackground,forexample,setthesection'sbackground.position:
activeSection.background.position = MediaPosition.FIT_TO_MEDIA;
Forallpossiblepositions,see"MediaPosition"onpage839.
Setting a page range in script
WhenaPDFthatservesasadynamicsectionbackgroundhasmultiplepages,youcanspecifyarange
ofpagestobeused,inacontrolscript.
Putthenumberofthefirstpageintherangeinthesection'sbackground.startfieldandthelastpagein
background.end.
Thefollowingscriptsetsthepagerangefrom2to5:
merge.template.contexts.PRINT.sections['Policy'].background.start = 2;
merge.template.contexts.PRINT.sections['Policy'].background.end = 5;
Settingapagerangeautomaticallysetsbackground.allPagestofalse(see"background"onpage829).
Ontheotherhand,whenyoufirstdefineapagerangeandthensetbackground.allPagestotrue,this
disablesthepagerange.
Tip: Youcouldusetheresource()functiontocheckthenumberofpagesorforexamplethe
pageheightandwidthbeforesettingitasabackground(see"resource()"onpage821).
ThisscriptsetsabackgroundonaPrintsectionusing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couldreplacethelastthreelinesofthepreviousscriptbythefollowinglinetoscalethePrintsec-
tionbackgroundtoMediasize:
Page 405