JavaScript runlist convenience functions

In order to use the convenience functions, you must first create an instance of the "Impose" class. This article defines this "Impose" class.

Constructor

const imposition = new Impose();
const imposition = new Impose( defaults );
Click to copy

Without defaults argument, the constructor creates a new Impose object with completely default settings. Specifying the defaults parameter allows overriding specific defaults for the imposition process.

If present, "defaults" must be an object with the following properties (which are all optional):

  • "unit": the default unit for the imposition configuration. Defaults to "pt" for point.
  • "slots": an array with slot definitions.
  • "shingling": default settings for automatic shingling.

addSheetDef

const sheetDefinitionID = imposition.addSheetDef( sheetDefinition );
const sheetDefinitionID = imposition.addSheetDef( width, height );
const sheetDefinitionID = imposition.addSheetDef( width, height, unit );
Click to copy

Creates a new sheet definition (not an imposed sheet, the definition from which you can later create an imposed sheet). The sheet definition can be created by passing a width and height (with an optional unit, if not passed it reverts to the default unit for this imposition). It can also be created from a sheet definition object.

The return value is the ID of the newly created sheet definition (which can then be used to create slots or actual imposed sheets).

addSheet

const sheetID = imposition.addSheet( sheetDefinitionID );
Click to copy

Creates an imposed sheet from the given sheet definition ID.

The return value is the ID of the newly created sheet. After creating the sheet, content can be added to it by using addPage or addText.

addSlot

const slotID = imposition.addSlot( sheetDefinitionID, slotDefinition );
Click to copy

Creates a new slot for the sheet definition with the given  ID. The slot is configured using the properties in the slot definition object.

The return value is the ID of the newly created slot, which can be used to add content to slots on specific sheets.

addPage

imposition.addPage( sheetID, slotID, pageIndex );
imposition.addPage( sheetID, slotID, pageIndex, options );
Click to copy

Places the page with (zero-based) index from the document we're imposing into the slot with ID "slotID" on the sheet with ID "sheetID". Optionally an options object is provided with the following properties:

  • shingling: a value that overrides the automatically generated shingling value for this page.

There is no return value.

addText

imposition.addText( sheetID, slotID, text );
Click to copy

Places the given "text" into the slot with ID "slotID" on the sheet with ID "sheetID".

There is no return value.