2022.2

Table Of Contents
Field Type Description
scale
NumberorObject SetthesizeofthePDFbackgroundasapercentageoftheoriginalimage.Acceptedvaluesare:
l
Anumericvalue.
l
Astringcontaininganumberandpercentagecharacter:"<number>%".
l
Anobjectwithtwoproperties,"x"and"y",withnumericvalues:"{x:100,y:100}".Ifx
andyaredifferenttheimagewillbestretched.
source
"BackgroundResource"on
page1294
SetthesourceofthePDFbackground(NONE,Datamapper,PDFResource).
SettingthebackgroundtoNONEdoesnotresetanyotheroption,suchastheposition
andscaleofthebackground.
start
Number ThestartpageofthePDFtouseasabackgroundforthesection.
top
Measurement ThetopoffsetofthePDFbackground(onlywhenabsolutepositioningisselected).
url
String ThelocationofthePDFtouseasabackgroundforthesection.ThreedifferentformsofURLsaresup-
ported:
l
Arelativepathtoanimageresource;thisalwaysstartswith"images/".Forafile
namedbackground.pdf,storedinsidethetemplateresources,theURLwouldbe
images/background.pdf.
l
AURL(eitherfile:,http:,orhttps:).Thecompletesyntaxforanexternalfile
is:file://<host>/<path>.Ifthehostis"localhost",itcanbeomitted,resulting
infile:///<path>,forexample:file:///c:/resources/images/image.jpg.
l
AnabsoluteWindows-stylepath.
ArelativepathandaURLareexpectedtobeURLencoded.Forexample,aspaceneedstobe
encodedas%20.
AnabsoluteWindows-stylepathdoesnotneedtobeURLencoded,butinJavaScriptanyback-
slashesinaStringneedtobedouble-escaped:"C:\\Images\\Image.pdf".
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:
activeSection.background.position = MediaPosition.FIT_TO_MEDIA;
Tip: Formoreexamples,see"ControlScript:SettingaPrintsection'sbackground"onpage845.
Page 1287