background

The background object holds the PDF background of a Print section (see section and Control Script: Setting a Print section's background).

Fields

Field Type Description
allPages Boolean

Show all pages from the PDF.

end Number The end page of the PDF to use as a background for the section.
left Measurement The left offset of the PDF background (only when absolute positioning is selected).
position MediaPosition Set the position of the PDF background (Absolute, centered, fit to media).
rotation

Number

Set the rotation of the PDF background to 0, 90, 180 or -90 degrees.
scale

Number

Set the size of the PDF background as a percentage of the original image.
source

BackgroundResource

Set the source of the PDF background (NONE, Datamapper, PDF Resource).
Setting the background to NONE does not reset any other option, such as 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. For a file named background.pdf, stored inside the template resources, the url would be images/background.pdf.
  • The complete syntax for an external 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.
  • Example

    This scripts sets a background on a Print section using 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 could replace the last three lines of the previous script by the following line to scale the Print section background to Media size:

    activeSection.background.position = MediaPosition.FIT_TO_MEDIA;