In order to use the convenience functions, you must first create an instance of the "Impose" class. This article defines this "Impose" class.
const imposition = new Impose(); const imposition = new Impose( defaults );
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.
const sheetDefinitionID = imposition.addSheetDef( sheetDefinition ); const sheetDefinitionID = imposition.addSheetDef( width, height ); const sheetDefinitionID = imposition.addSheetDef( width, height, unit );
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).
const sheetID = imposition.addSheet( sheetDefinitionID );
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.
const slotID = imposition.addSlot( sheetDefinitionID, slotDefinition );
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.
imposition.addPage( sheetID, slotID, pageIndex ); imposition.addPage( sheetID, slotID, pageIndex, options );
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.
imposition.addText( sheetID, slotID, text );
Places the given "text" into the slot with ID "slotID" on the sheet with ID "sheetID".
There is no return value.