The Global interface gives access to the global compontents which make up a MegaEdit product for the current job.

This includes

  • The Canvas and CanvasSize which define the size/aspect ratio of the pages within the product
  • the dynamic size if that is enabled for the current product which allows to control the size directly and dynamically within a preconfigured range.
  • the StockItem which defines the stock used to produce. This is used to calculate weight and thickness
  • the OutputType which controls how the pages are set together (single page vs spread), if covers are used, the bleed and margin settings etc

There are separate methods available to retrieve each of those components as they are currently applied to the job and methods available to set and update each component for the current job.

Hierarchy

  • Global

Properties

Properties

Get: {
    CanvasAndSize() => CanvasAndSizeResult;
    DynamicSize() => Size;
    OutputType() => OutputType;
    StockItem() => StockItem;
}

This property retrieves the currently applied components of the current job.

Type declaration

  • CanvasAndSize:function
  • DynamicSize:function
    • Retrieve the dynamic size if this product is using dynamic sizes

      Returns Size

      The current dynamic size or null if this product is not using dynamic sizes

  • OutputType:function
    • Retrieve the currently selected output type

      Returns OutputType

      The currently selected output type

  • StockItem:function
    • Retrieve the currently selected stock item

      Returns StockItem

      The currently selected stock item

Set: {
    CanvasAndSize(canvasObjectOrId, sizeObjectOrId, callback?, applySmartLayout?, refresh?, maintainFieldSize?) => void;
    DynamicSize(width, height, callback?, applySmartLayout?, refresh?, maintainFieldSize?, optionalPageId?) => void;
    OutputType(objectOrId) => boolean;
    StockItem(objectOrId) => boolean;
}

This property updates and sets the components to the current job.

Type declaration

  • CanvasAndSize:function
    • Updates the current canvas and/or size. This can be used to change to a different size for the same canvas or a new canvas with new size altogether. This should not be used when the product is configured for dynamic sizing.

      Parameters

      • canvasObjectOrId: string | Canvas

        The canvas object or id to change to

      • sizeObjectOrId: string | CanvasSize

        The size object or id to change to

      • Optional callback: (() => void)

        The callback function to call when the canvas and size have been updated. If the canvas/size is not being updated the callback will not be triggered.

          • (): void
          • Returns void

      • Optional applySmartLayout: boolean

        Flag to control if the canvas and size change should use smart layout. Smart layout will attempt to apply a similary named layout (category + name) for the target canvas based on the currently used layouts. If the layout is not found or none is used, this will have no effect.

      • Optional refresh: boolean

        Flag to control if the editor would reinitialize itself. If additional operations are required after the canvas and size change, this should be set to false and the refresh should be called manually.

      • Optional maintainFieldSize: boolean

        Flag to control if the field sizes should be maintained. If smart layout is used, we will use the new layout dimenions. If smart layout is not used, the field sizes will be adjusted proportionally to the new canvas size. If this flag is used, the field dimensions will not be adjusted (ignored when smart layout is used).

      Returns void

  • DynamicSize:function
    • Updates the current dynamic size. Can only be used if the product is configured for dynamic sizing. The dimensions are in points and will be restricted to be within the min/max dimensions of the product. Step sizes are not enforced.

      Parameters

      • width: number

        The new width in points

      • height: number

        The new height in points

      • Optional callback: (() => void)

        The optional callback. This will be called if the size was changed successfully. If the size could not be changed, no callback will be triggered.

          • (): void
          • Returns void

      • Optional applySmartLayout: boolean

        Flag to control if the canvas and size change should use smart layout. Smart layout will attempt to apply a similary named layout (category + name) for the target canvas based on the currently used layouts. If the layout is not found or none is used, this will have no effect.

      • Optional refresh: boolean

        Flag to control if the editor would reinitialize itself. If additional operations are required after the canvas and size change, this should be set to false and the refresh should be called manually.

      • Optional maintainFieldSize: boolean

        Flag to control if the field sizes should be maintained. If smart layout is used, we will use the new layout dimenions. If smart layout is not used, the field sizes will be adjusted proportionally to the new canvas size. If this flag is used, the field dimensions will not be adjusted (ignored when smart layout is used).

      • Optional optionalPageId: string

        Optional page id. If null, all pages will change the size. If the setup allows different aspect ratios for different pages, optionally you can configure the page id to change only the size of a single page.

      Returns void

  • OutputType:function
    • Updates the current output type.

      Parameters

      • objectOrId: string | OutputType

        The output type object or id to change to

      Returns boolean

      Boolean flag to control if the output type was changed

  • StockItem:function
    • Updates the current stock item.

      Parameters

      • objectOrId: string | StockItem

        The stock item object or id to change to

      Returns boolean

      Boolean flag to control if the stock item was changed

Generated using TypeDoc