2019.1

Table Of Contents
Note
Encrypted PDF files are not supported in PDF pass-through mode.
For information about Control Scripts in general, see "Control Scripts" on page828 and
"Control Script API" on page1280. If you don't know how to write scripts, see "Writing your own
scripts" on page798.
Setting a background in script
The Control Script should first enable a background on the section, in case an initial
background wasn't set via the user interface. This is done by setting the source type for the
background of the section to either DataMapper PDF orResource PDF (see
"BackgroundResource" on page1306). For example:
merge.template.contexts.PRINT.sections['Policy'].background.source
= BackgroundResource.RESOURCE_PDF;
A DataMapper PDF is, as you would expect, a PDF generated by the DataMapper. A Resource
PDF is a PDF from another source.
For a DataMapper PDF, nothing else has to be done to set the background.For a Resource
PDF, the Control Script should specify a path, for example:
var resourceUrl = 'images/policy-' + record.fields.policy + '.pdf';
merge.template.contexts.PRINT.sections['Policy'].background.url =
resourceUrl;
Note
An image with an unknown file extension is represented by a red cross in the output, but
no error is logged unless the image refers to a local file that does not exist on disk.
Image file extensions that the software recognizes are: AFP, BMP, EPS, GIF, JPG/JPEG,
PCL, PDF, PNG, PS, SVG, and TIF/TIFF.
Page 836