Class: AuWidgetPreflight

A widget that is used to verify that pre-designed user files are compatible with your printing equipment.

For details, you can refer to the Preflight widget topic.

{
  "widgets": [{
    "name": "preflight",
    "type": "preflight",
    "params": {
      "config": {
        "backendUrl": "http://preflight.example.com",
        "product": {
          "dpi": 300,
          "size": {
            "width": 595,
            "height": 842
          },
          "bleed": 20,
          "safetyLines": [{
            "color": "#00ff00",
            "altColor": "#00ff00",
            "margin": 40
          }]
        },
        "rules": [
          {
            "type": "colorspace",
            "severity": "error",
            "enableFix": true,
            "params": {
              "allowedColorSpaces": [ "cmyk" ]
            }
          }
        ],
        ...
     }
  }]
}

You can find the detailed description of the preflight configuration in the config reference.

Hierarchy

AuBaseWidget

AuWidgetPreflight

Implements

Index

Properties

Accessors

Methods

Properties

failedChecks

failedChecks: FailedChecksModel = new FailedChecksModel([], [])

An object containing two arrays, errors and warnings, with failed validation rules.


hasFiles

hasFiles: boolean = false


hires

hires: string[] = []

A string array of URLs that link to the print-ready file in PDF format.


origins

origins: OriginModel[] = []

A links to origin images of surfaces.


page

page: PreflightToolStep = '' as PreflightToolStep

The current preflight page - either uploader or editor.


params

params: any

Inherited from AuBaseWidget.params

Compiled widget configuration.


paramsRaw

paramsRaw: any

Inherited from AuBaseWidget.paramsRaw

Uncompiled widget configuration.


preview

preview: string[] = []

A string array of URLs that link to proof images.


previews

previews: PreviewModel[] = []

Accessors

pages

get pages(): number

Gets the number of pages.

Returns:number

Methods

addCustomStyles

addCustomStyles(params: any): void

Inherited from AuBaseWidget.addCustomStyles

Applies new styles to a widget.

Parameters:

Name Type
params any

Returns:void


compile

compile(additionalParam: any): Promise‹any›

Inherited from AuBaseWidget.compile

Compiles the widget config.

"steps": [{
  "name": "card-size",
  "title": "Step 1. Card Options",
  "description": "Choose a card size.",
  "toolPanel": {
    "name": "options"
  },
  "onActivate": [
    "{{#function $['logo'].compile() }}"
  ]
},
...

Parameters:

Name Type Default Description
additionalParam any Parameters for widget config compilation.

Returns:Promise‹any›

The compiled widget configuration.


emitChange

emitChange(data: any, forceRecompile: boolean): void

Inherited from AuBaseWidget.emitChange

Sends a message about the widget state changes.

"steps": [{
  "name": "card-size",
  "title": "Step 1. Card Options",
  "description": "Choose a card size.",
  "toolPanel": {
    "name": "options"
  },
  "onActivate": [
    "{{#function $['options'].emitChange()}}"
  ]
},
...

Parameters:

Name Type Default Description
data any Data for updating the widget.
forceRecompile boolean false If true, runs widget recompilation to apply the updated parameters.

Returns:void


getResults

getResults(): Promise‹FinishModel

Gets links to print-ready, preview images and origin files.

Returns:Promise‹FinishModel


setFiles

setFiles(fileUrls: string[]): Promise‹void›

Inserts files into the current product starting from the first page.

Parameters:

Name Type Description
fileUrls string[] An array of links to the files.

Returns:Promise‹void›


setStep

setStep(step: PreflightToolStep): Promise‹void›

Sets the current preflight page.

Parameters:

Name Type Description
step PreflightToolStep You can enable either uploader or editor.

Returns:Promise‹void›


showPreloader

showPreloader(isPreload: boolean, message: string): void

Inherited from AuBaseWidget.showPreloader

Shows a preloader.

"onClick": [
  "{{#function main.showPreloader(true, 'Creating print files...')}}",
  "{{#function $['editor'].getHiResImages(800,800)}}",
  "{{#function main.showPreloader(false)}}"
]

Parameters:

Name Type Default Description
isPreload boolean - If true, enables the preloader.
message string undefined A text message that appears next to the preloader.

Returns:void


showToast

showToast(data?: string, duration?: number): void

Inherited from AuBaseWidget.showToast

Shows a toast.

return editor.loadUserInfo(data)
    .catch(err => {
        this.widget.showToast("Error: Invalid data");
        console.log(err);
    });

Parameters:

Name Type Description
data? string A string message to display in the toast.
duration? number Defines how long to show the toast for.

Returns:void