JavaScript runlist object definitions

In the convenience functions, or when creating an imposition runlist using nothing but JavaScript objects directly, the following  objects can be used.

The "sheet_defs" array

A collection of all defined sheets and its slots, either from the sheet config or dynamic sheets. The "sheet_defs" array can contain sheet definition objects. A sheet definition object can contain the following properties:

"id"

  • "id": String ID, can be used to reference a sheet definition by name. This property is required.

"rect"

  • "rect": A rectangle that defines the size of the sheet. See "rect" object.  

"slots"

  • "slots" is an array of slot objects.
"sheet_defs":
  [
    {
      "id": "",
      "rect": {  },
      "slots":
            [
              {  }
            ]
    }
  ],
Click to copy

The "sheets" array

A collection of all generated sheets including their placements. The "sheets" array contains sheet objects. A sheet object can contain the following properties:

"sheet_def"

  • "sheet_def": Index or string id of reference sheet definition.

"placements"

Example

"sheets":
  [
    {
      "sheet_def": 0,
      "placements":
      [
        {  }
                
      ]
    }
  ]
Click to copy

The "defaults" object

The "defaults" object is optional. If certain properties are defined here, they will be used if no specifications have been made in the "sheet_defs" array. The "defaults" object can contain the following objects:

"unit"

  • The default unit for the imposition configuration. All possible "unit" values are listed here. Default: "pt".

"slots"

  • An array with slot definitions. All "slots" properties are listed here.

"shingling"

  • Default settings for automatic shingling. Depending on the values specified in the shingling object the engine calculates the value for the shingling automatically. The "shingling" object can contain the following properties:
  • "unit": see Unit. Default: inherited, "pt"
  • "method": String, one of "shift", "scale", "scale_proportional". Default: "scale".
  • "direction": String, one of "inwards", "outwards", "both". Default: "inwards"
  • "increment": Number. Default: 0
  • "book_size": Integer. Default: 0
  • "staple_size": Integer. Default: 0

Note:  A more detailed explanation of the shingling parameters can be found in this article.

"defaults":
  {
    "unit": "mm",
    "slots":
        { },
    "shingling": {
        "unit" : "mm",
        "method" : "scale",
        "direction" : "inwards",
        "increment" : 0.12,
        "book_size" : 16,
        "staple_size" : 4
        }
  },
Click to copy

Common objects and strings

"rect" object

Definition of a rectangle. It can be part of the "sheet_defs" array and of a slot object. The "rect" object contains the following properties:

  • "unit": see Unit. The unit for all other measurements. Optional. Default: inherited, "pt".
  • "left": Number. The left hand side of the rectangle. Default: 0.
  • "bottom": Number. The bottom side of the rectangle. Default: 0.
  • "right": Number. The right hand side of the rectangle. Default: 0.
  • "top": Number. The top side of the rectangle. Default: 0.
  • "width": Number. Optional. Overwrites "right" with "left + width" if present.
  • "height": Number. Optional. Overwrites "top" with "bottom + height" if present.
Example

"rect" : 
  {
    "bottom" : 28.5,
    "height" : 114,
    "left" : 552.5,
    "width" : 171
  },
Click to copy

"trim_box" object

Definition of an optional rectangle. It can be part of the "sheet_defs" array only. The "trim_box" object contains the following properties:

  • "unit": see Unit. The unit for all other measurements. Optional. Default: inherited, "pt".
  • "left": Number. The left hand side of the rectangle. Default: 0.
  • "bottom": Number. The bottom side of the rectangle. Default: 0.
  • "right": Number. The right hand side of the rectangle. Default: 0.
  • "top": Number. The top side of the rectangle. Default: 0.
  • "width": Number. Optional. Overwrites "right" with "left + width" if present.
  • "height": Number. Optional. Overwrites "top" with "bottom + height" if present.
Example

"trim_box" : 
  {
    "left":3,
    "bottom":3,
    "width": 297,
    "height": 210
  },
Click to copy

"crop_marks" object

The "crop_marks" object can be part of a slot object. It can contain the following properties:

  • "unit": see Unit. Default: inherited, "pt"
  • "left_bottom": see Crop Mark Direction. Default: "N".
  • "left_top": see Crop Mark Direction. Default: "N".
  • "right_bottom": see Crop Mark Direction. Default: "N".
  • "right_top": see Crop Mark Direction. Default: "N".
  • "length": Number. Default: 10
  • "gap": Number. Default: 3
  • "width": Number. Default: 1
  • "color_space": see Color Space. Default: "ALL"
  • "spot_name": Name of the spot color
  • "color_components": Array of doubles (in percent). Default: [0,0,0,100]
  • "tint_value": double [0,100]. Default: 100
Example

"crop_marks": 
  {
    "unit": "pt"
    "left_bottom": "N", 
    "right_bottom": "N", 
    "right_top": "N", 
    "left_top": "N", 
    "length": 10, 
    "width": 0.04, 
    "gap": 2,
    "color_space": "SPOT",
    "spot_name": "Green",
    "color_components": [100,0,100,0],
    "tint_value": 100
  },
Click to copy

"text" object

The "Text" object can be part of a slot object. It can contain the following properties:

  • "unit": see Unit. Default: inherited, “pt”
  • "font": String. Default: "Helvetica"
  • "size": Number. Default: "12"
  • "color_space": see Color Space. Default: "ALL"
  • "color_components": Array of doubles (in percent). Default: [0,0,0,100]
  • "spot_name": Name of the spot color (if "color_space": "SPOT")
  • "tint_value": double [0,100]. Default: 100
Example

"text" : 
  {
    "color_components" : [0,0,0,100],
    "color_space" : "ALL",
    "font" : "Helvetica",
    "size" : 8,
    "unit" : "pt"
  },
Click to copy

"bleed" object

The definition of where (and how much) bleed is required for a Rectangle. The "bleed" object can be part of a slot object. It can contain the following properties:

  • "unit": see Unit. The unit for all other measurements. Optional. Default: inherited, "pt".
  • "left": Number. Bleed required on the left. Default: 0.
  • "bottom": Number. Bleed required at the bottom. Default: 0.
  • "right": Number. Bleed required on the right. Default: 0.
  • "top": Number. Bleed required at the top. Default: 0.
Example

"bleed" :  
  {
    "bottom" : 2.5,
    "left" : 2.5,
    "right" : 2.5,
    "top" : 2.5
  },
Click to copy

"clip_mode" string

Defines how imposed pages are clipped.  The "clip_mode" string can be part of a slot object. It can contain the following values:

  • "S": Slot. Imposed pages are clipped at the slot boundaries
  • "P": Positioned page.  Imposed pages are clipped according to their TrimBox plus bleed as set up in the slot.
    Default: "P"
Example

"clip_mode": "P",
Click to copy

"rotation" string

Page rotates anti-clockwise (value, basic unit of measurement: degrees). The "rotation" string can be part of a slot object. It can have the following values: 0, 90, 180, 270

Example

"rotation" : 270,
Click to copy

"scale" object

The "scale" object can be part of a slot object. It can be a number or it can contain the following properties:

  • "horizontal": Double
  • "vertical": Double
Example 1

"scale": {"horizontal": -1, "vertical":-1 },
// the page is scaled proportionally to fit the slot
// default if no "scale" object is set

Example 2

"scale": 25,
// affects the corresponding scaling 

Example 3

"scale": 100,
// no scaling

Example 4

"scale" : 0,
// the page is scaled unproportionally to fill the slot
Click to copy

"binding_margin" string

Binding margin defines the edge on which the creep should be equalized. It is required if shingling shall be applied to a slot and must be set to a value other than "N" in this case.
The "binding_margin" string  can be part of a slot object. It can have the following values:

  • "L": Left
  • "R": Right
  • "T": Top
  • "B": Bottom
  • "N": None
Example

"binding_margin": "N",
Click to copy

"placement" string

Direction of the margin. The "placement" string  can be part of a slot object. It can have the following values:

  • "LB": align left bottom
  • "LC": align left center
  • "LT": align left top
  • "CT": align center top
  • "RT": align right top
  • "RC": align right center
  • "RB": align right bottom
  • "CB": align center bottom
  • "CC": align center, i.e. both vertically and horizontally
Example

"placement": "CC",
Click to copy

Slot object

A slot object is used in the "sheet_defs" array and in the "defaults" object (optional). It can contain the following properties:

Example

{
  "id": "left",
  "isolated": true,
  "rect" : {
     "bottom" : 274,
     "height" : 226,
     "left" : 5.2999999999999998,
     "width" : 5 
     },
  "bleed": {
     "left": 0, 
     "bottom": 0, 
     "right": 0, 
     "top": 0 
     },
  "crop_marks" : {
     "color_components" : [ 100, 0, 100, 0 ],
     "color_space" : "SPOT",
     "gap" : 2,
     "left_bottom" : "B",
     "left_top" : "N",
     "length" : 5,
     "right_bottom" : "RB",
     "right_top" : "R",
     "tint_value" : 100,
     "unit" : "mm"
     },
  "text" : 
     {
     "font" : "Helvetica",
     "size" : 8,
     "unit" : "pt"
     },
  "scale" : 100,
  "rotation": 0,
  "clip_mode": "P",
  "placement": "CC",
  "bleed_shingling": false,
  "binding_margin": "N"
},
Click to copy

Placements object

"placements" is an array of placements objects. It is used in the "sheets" array. A placements object can contain the following properties:

  • "slot": String or number. Id or index of slot to be used for placement.
  • "page": Number, zero based. Page index to be placed in slot.
  • "text": A text to be placed in the slot. Sring.
  • "shingling": see Shingling. If a "value" property is defined automatic shingling is disabled and value is used directly.  
Example

{ 
  "slot": "middle", 
  "page": 0,
  "text": "This is text",
  "shingling": 
    {
      "unit": "mm",
      "value": 5
    }
},
Click to copy

Shingling object

The "shingling" object can be part of the "placements" object. It can contain the following properties:

  • "unit": see Unit. Default: inherited, "pt"
  • "value": Number. If a value is defined, the automatic shingling is disabled. Default: 0
Example

"shingling": 
  {
    "unit": "mm",
    "value": 5
  }
Click to copy

Possible values

Unit

A string used to identify the unit of a number:

  • one of:  "mm", "cm", "m", "in", "ft", "pt" or "pc"

Crop Mark Directions

  • String. One of:
    • "N": None
    • "L": Left
    • "R": Right
    • "T": Top
    • "B": Bottom
    • "LT": Left and Top
    • "LB": Left and Bottom
    • "RT": Right and Top
    • "RB": Right and Bottom

Color Space

  • String. One of:  "ALL", "CMYK", "RGB", "GRAY", "SPOT"

Complete JavaScript runlist sample

A very simple sample can be found here, which is just placing the first page into 1 of 3 slots.

let cfg =
{
    "defaults":
    {
        "unit": "mm",
        "slots":
        {
            "crop_marks": 
            {
                "left_bottom": "N", 
                "right_bottom": "N", 
                "right_top": "N", 
                "left_top": "N", 
                "length": 10, 
                "width": 0.04, 
                "gap": 2
            },
            "isolated": true,
            "text":
            {
                "font": "Helvetica",
                "size": 8,
                "unit": "pt"
            }
        }
    },
    
    "sheet_defs":
    [
        {
            "id": "A4 Landscape",
            "rect":{"width": 297,"height": 210},
            "slots":
            [
                {
                    "id": "left",
                    "rect":{"left": 0, "bottom": 0, "width": 148.5, "height": 210},
                    "bleed":{"left": 0, "bottom": 0, "right": 0, "top": 0},
                    "scale":{"horizontal": -1, "vertical":-1},
                    "rotation": 0,
                    "placement": "CC",
                    "binding_margin": "N",
                    "crop_marks": {"left_bottom": "LB", "left_top": "LT", "right_bottom": "RB", "right_top": "RT"}
                },
                {
                    "id": "right",
                    "rect":{"left": 148.5, "bottom": 0, "width": 148.5, "height": 210},
                    "bleed":{"left": 0, "bottom": 0, "right": 0, "top": 0},
                    "scale":25,
                    "rotation": 0,
                    "placement": "CC",
                    "binding_margin": "N",
                    "crop_marks": {"left_bottom": "LB", "left_top": "LT", "right_bottom": "RB", "right_top": "RT"}
                },
                {
                    "id": "middle",
                    "rect":{"left": 74.25, "bottom": 0, "width": 148.5, "height": 210},
                    "bleed":{"left": 0, "bottom": 0, "right": 0, "top": 0},
                    "scale":25,
                    "rotation": 0,
                    "placement": "CC",
                    "binding_margin": "N",
                    "crop_marks": {"left_bottom": "LB", "left_top": "LT", "right_bottom": "RB", "right_top": "RT", "length": 2, "color_space": "cmyk", "color_components": [100,0,0,0]}
                },
                {
                    "id": "legend",
                    "rect":{"left": 10, "bottom": 10 },
                    "left": 0,
                    "bottom": 0,
                    "width": 20,
                    "heigth": 100
                }
            ]
        }
    ],
    "sheets":
    [
        {
            "sheet_def": 0,
            "placements":
            [
                { "slot": "middle", "page": 0},
                { "slot": "legend", "text": "This is text"}
            ]
        }
    ]
}
cfg;
Click to copy