Position

The positions property of the sheetConfig object (see sheetConfig) can be used to repeat the sheet configuration after a certain number of pages, or to retrieve and modify settings for sheets in different positions. Available positions are:

  • single: The only sheet in a section.
  • first: The first sheet in the section.
  • middle: All after the first sheet and before the last sheet in a section.
  • last: The last sheet in a section.
  • all: All sheets in the section.
    Settings for all sheets may conflict with settings for a particular position. In such cases, the setting that was specified last overrides the other.

Each of these positions has the following fields.

Field Type Description
allowContent AllowContent

Used to specify on which sides of a sheet (in a certain position) content is allowed.
Possible values:

  • AllowContent.ALL_SIDES
  • AllowContent.FRONT_ONLY (only with duplex printing)
  • AllowContent.BACK_ONLY (only with duplex printing)
  • AllowContent.NONE (not allowed on all, single and middle positions)

masterBack String Specifies the Master Page to use on the backside of sheets in this position.
masterFront String Specifies the Master Page to use on the front of sheets in this position.
media String Specifies the Media to use with sheets in this position.
repeat Number

Repeat the sheet configuration every n number of pages. This is useful e.g. when documents can be so long that they cannot fit in one envelope.

To remove a Media or Master Page via script, give it the value undefined, or null, or an empty string (""); see the examples below.

Examples

This script retrieves a Print section and modifies a number of settings for all of its sheets.

let section = merge.template.contexts.PRINT.sections["Section 1"];

section.sheetConfig.positions.all.allowContent = AllowContent.ALL_SIDES;

section.sheetConfig.positions.all.media = "MyMedia";

section.sheetConfig.positions.all.masterFront = "Master page 1";

section.sheetConfig.positions.all.masterBack = undefined; // or null, or an empty string

The following script ensures that empty backsides of single sheets are omitted.

let section = merge.template.contexts.PRINT.sections["Section 1"];

section.sheetConfig.positions.single.omitMasterOnEmptyBackside = true;